Просмотр исходного кода

Merge branch 'master' of github.com:bkaradzic/bx

Branimir Karadžić 11 лет назад
Родитель
Сommit
0bca2eba02
2 измененных файлов с 32 добавлено и 20 удалено
  1. 17 11
      include/bx/mutex.h
  2. 15 9
      include/bx/sem.h

+ 17 - 11
include/bx/mutex.h

@@ -56,6 +56,11 @@ namespace bx
 
 	class Mutex
 	{
+		BX_CLASS(Mutex
+			, NO_COPY
+			, NO_ASSIGNMENT
+			);
+
 	public:
 		Mutex()
 		{
@@ -78,14 +83,17 @@ namespace bx
 		}
 
 	private:
-		Mutex(const Mutex& _rhs); // no copy constructor
-		Mutex& operator=(const Mutex& _rhs); // no assignment operator
-
 		pthread_mutex_t m_handle;
 	};
 
 	class MutexScope
 	{
+		BX_CLASS(MutexScope
+			, NO_DEFAULT_CTOR
+			, NO_COPY
+			, NO_ASSIGNMENT
+			);
+
 	public:
 		MutexScope(Mutex& _mutex)
 			: m_mutex(_mutex)
@@ -99,10 +107,6 @@ namespace bx
 		}
 
 	private:
-		MutexScope(); // no default constructor
-		MutexScope(const MutexScope& _rhs); // no copy constructor
-		MutexScope& operator=(const MutexScope& _rhs); // no assignment operator
-
 		Mutex& m_mutex;
 	};
 
@@ -110,6 +114,12 @@ namespace bx
 
 	class LwMutexScope
 	{
+		BX_CLASS(LwMutexScope
+			, NO_DEFAULT_CTOR
+			, NO_COPY
+			, NO_ASSIGNMENT
+			);
+
 	public:
 		LwMutexScope(LwMutex& _mutex)
 			: m_mutex(_mutex)
@@ -123,10 +133,6 @@ namespace bx
 		}
 
 	private:
-		LwMutexScope(); // no default constructor
-		LwMutexScope(const LwMutexScope& _rhs); // no copy constructor
-		LwMutexScope& operator=(const LwMutexScope& _rhs); // no assignment operator
-
 		LwMutex& m_mutex;
 	};
 

+ 15 - 9
include/bx/sem.h

@@ -28,6 +28,11 @@ namespace bx
 #	if BX_CONFIG_SEMAPHORE_PTHREAD
 	class Semaphore
 	{
+		BX_CLASS(Semaphore
+			, NO_COPY
+			, NO_ASSIGNMENT
+			);
+
 	public:
 		Semaphore()
 			: m_count(0)
@@ -114,9 +119,6 @@ namespace bx
 		}
 
 	private:
-		Semaphore(const Semaphore& _rhs); // no copy constructor
-		Semaphore& operator=(const Semaphore& _rhs); // no assignment operator
-
 		pthread_mutex_t m_mutex;
 		pthread_cond_t m_cond;
 		int32_t m_count;
@@ -126,6 +128,11 @@ namespace bx
 
 	class Semaphore
 	{
+		BX_CLASS(Semaphore
+			, NO_COPY
+			, NO_ASSIGNMENT
+			);
+
 	public:
 		Semaphore()
 		{
@@ -179,9 +186,6 @@ namespace bx
 		}
 
 	private:
-		Semaphore(const Semaphore& _rhs); // no copy constructor
-		Semaphore& operator=(const Semaphore& _rhs); // no assignment operator
-
 		sem_t m_handle;
 	};
 #	endif // BX_CONFIG_SEMAPHORE_PTHREAD
@@ -190,6 +194,11 @@ namespace bx
 
 	class Semaphore
 	{
+		BX_CLASS(Semaphore
+			, NO_COPY
+			, NO_ASSIGNMENT
+			);
+
 	public:
 		Semaphore()
 		{
@@ -214,9 +223,6 @@ namespace bx
 		}
 
 	private:
-		Semaphore(const Semaphore& _rhs); // no copy constructor
-		Semaphore& operator=(const Semaphore& _rhs); // no assignment operator
-
 		HANDLE m_handle;
 	};