Refactored the ReentrantMutex support so that it utilises the underling thread implementation for recusive mutex support.
This commit is contained in:
@@ -30,17 +30,25 @@ using namespace OpenThreads;
|
||||
//
|
||||
// Use: public.
|
||||
//
|
||||
Mutex::Mutex() {
|
||||
Mutex::Mutex(MutexType type):
|
||||
_mutexType(type)
|
||||
{
|
||||
|
||||
pthread_mutexattr_t mutex_attr;
|
||||
pthread_mutexattr_init( &mutex_attr );
|
||||
|
||||
PThreadMutexPrivateData *pd = new PThreadMutexPrivateData();
|
||||
|
||||
#ifndef __linux__ // (not available until NPTL) [
|
||||
pthread_mutexattr_settype( &mutex_attr, PTHREAD_MUTEX_ERRORCHECK );
|
||||
#endif // ] __linux__
|
||||
|
||||
if (type==MUTEX_RECURSIVE)
|
||||
{
|
||||
pthread_mutexattr_settype( &mutex_attr, PTHREAD_MUTEX_RECURSIVE );
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef __linux__ // (not available until NPTL) [
|
||||
pthread_mutexattr_settype( &mutex_attr, PTHREAD_MUTEX_ERRORCHECK );
|
||||
#endif // ] __linux__
|
||||
}
|
||||
#ifdef ALLOW_PRIORITY_SCHEDULING // [
|
||||
|
||||
#ifdef __sun // [
|
||||
|
||||
@@ -34,7 +34,9 @@ using namespace OpenThreads;
|
||||
//
|
||||
// Use: public.
|
||||
//
|
||||
Mutex::Mutex() {
|
||||
Mutex::Mutex(MutexType type):
|
||||
_mutexType(type)
|
||||
{
|
||||
|
||||
SprocMutexPrivateData *pd = new SprocMutexPrivateData();
|
||||
|
||||
|
||||
@@ -81,7 +81,10 @@ static void _S_nsec_sleep(int __log_nsec) {
|
||||
//
|
||||
// Use: public.
|
||||
//
|
||||
Mutex::Mutex() {
|
||||
Mutex::Mutex(MutexType type):
|
||||
_mutexType(type)
|
||||
)
|
||||
{
|
||||
Win32MutexPrivateData *pd = new Win32MutexPrivateData();
|
||||
_prvData = static_cast<void *>(pd);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user