diff options
author | Mark Spruiell <mes@zeroc.com> | 2003-02-25 14:38:02 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2003-02-25 14:38:02 +0000 |
commit | 2964231398170c94839cf74d9e84c9e6b3115e3b (patch) | |
tree | 6c5ca0a67598db2f420ea448ca8b11b62b4696de /cpp/src/IceUtil/RecMutex.cpp | |
parent | minor (diff) | |
download | ice-2964231398170c94839cf74d9e84c9e6b3115e3b.tar.bz2 ice-2964231398170c94839cf74d9e84c9e6b3115e3b.tar.xz ice-2964231398170c94839cf74d9e84c9e6b3115e3b.zip |
more portability fixes
Diffstat (limited to 'cpp/src/IceUtil/RecMutex.cpp')
-rw-r--r-- | cpp/src/IceUtil/RecMutex.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/cpp/src/IceUtil/RecMutex.cpp b/cpp/src/IceUtil/RecMutex.cpp index 7e0431fe89d..b79ed97420b 100644 --- a/cpp/src/IceUtil/RecMutex.cpp +++ b/cpp/src/IceUtil/RecMutex.cpp @@ -88,38 +88,32 @@ IceUtil::RecMutex::lock(LockState& state) const IceUtil::RecMutex::RecMutex() : _count(0) { + int rc; + +#if _POSIX_VERSION >= 199506L pthread_mutexattr_t attr; - int rc = pthread_mutexattr_init(&attr); + rc = pthread_mutexattr_init(&attr); if(rc != 0) { throw ThreadSyscallException(__FILE__, __LINE__); } - + rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); if(rc != 0) { throw ThreadSyscallException(__FILE__, __LINE__); } - - rc = pthread_mutex_init(&_mutex, &attr); - if(rc != 0) - { - throw ThreadSyscallException(__FILE__, __LINE__); - } - -/* -#ifdef __linux__ +#elif defined(__linux__) const pthread_mutexattr_t attr = { PTHREAD_MUTEX_RECURSIVE_NP }; #else const pthread_mutexattr_t attr = { PTHREAD_MUTEX_RECURSIVE }; #endif - - int rc = pthread_mutex_init(&_mutex, &attr); + + rc = pthread_mutex_init(&_mutex, &attr); if(rc != 0) { throw ThreadSyscallException(__FILE__, __LINE__); } -*/ } IceUtil::RecMutex::~RecMutex() |