Hello,
On a RH 7.3 system I'm trying to implement a recursive mutex where a
thread which has acquired a mutex can again acquire the same mutex
without deadlock.
>From reading the man pages it appears I can do something like
this to create the mutex:
pthread_mutex_t log_lock;
pthread_mutexattr_t mutex_attr;
rc = pthread_mutexattr_init ( & mutex_attr );
if ( rc == 0 ) {
rc = pthread_mutexattr_settype ( &mutex_attr, PTHREAD_MUTEX_RECURSIVE );
if ( rc == 0 ) {
rc = spch_mutex_create ( &log_lock, &mutex_attr );
}
}
When I compile this the compiler returns an error complaining that
pthread_mutexattr_settype and PTHREAD_MUTEX_RECURSIVE
are undefined.
Sure enough I see in pthread.h that these are both #ifdef __USE_UNIX98.
Defining __USE_UNIX98 before including pthread.h generates many
other compiler errors. I'm curious about this #ifdef...
Can anyone show me the correct way to create a recursive mutex?
Thanks,
Charles Prosser
_______________________________________________
Redhat-devel-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-devel-list