This commit is contained in:
Branimir Karadžić
2014-06-09 20:18:06 -07:00
parent c535289090
commit 2e7553adfd
2 changed files with 32 additions and 20 deletions

View File

@@ -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;
};

View File

@@ -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;
};