if it possible, please add option for OFMutex to create recursive mutexes, something like:
OFMutex::OFMutex(OFBool recursive)
: theMutex(NULL)
{
#ifdef WINDOWS_INTERFACE
theMutex = (void *)(CreateMutex(NULL, FALSE, NULL));
#elif defined(POSIX_INTERFACE)
pthread_mutex_t *mtx = new pthread_mutex_t;
if (mtx)
{
pthread_mutexattr_t _attr;
if (recursive) {
pthread_mutexattr_init(&_attr);
pthread_mutexattr_settype(&_attr, PTHREAD_MUTEX_RECURSIVE);
}
if (pthread_mutex_init(mtx, recursive ? &_attr : NULL)) delete mtx;
else theMutex = mtx;
}
#elif defined(SOLARIS_INTERFACE)
// i am not sure how to init recursive mutexes under solaris
// seems like 2.6-- kernels dont support this type
mutex_t *mtx = new mutex_t;
if (mtx)
{
if (mutex_init(mtx, USYNC_THREAD, NULL)) delete mtx;
else theMutex = mtx;
}
#else
#endif
}
-----------------
Thanks!
recursive mutexes
Moderator: Moderator Team
Who is online
Users browsing this forum: Google [Bot] and 1 guest