apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Orton <jor...@redhat.com>
Subject Re: Recursive mutex
Date Thu, 21 Jul 2005 15:00:22 GMT
On Wed, Jul 20, 2005 at 06:26:55PM -0700, Henry Jen wrote:
> I need to have recursive(NESTED) mutex support in our project.
> 
> Currently apr is relying on pthread lib to provide 
> pthread_mutexattr_settype to provide recursive support, unfortunately, 
> that does not seem to be in POSIX standard and is not available on the 
> requested linux platform(see 
> http://www.lynuxworks.com/products/posix/function-calls.php3).

mutexattr_settype is in a later POSIX standard (2001 I think), FWIW.

> I plan to implement that in apr by extend current apr_thread_mutex_t to 
> include a pthread_t and an integer for count, and modify the lock/unlock 
> accordingly. So here are couple questions:

Well, I'm not sure it can actually be done correctly using simply a 
pthread_t and an counter; that was what the previous code did before 
recursive mutexes where used, and it didn't work.

> 1. Is this a reasonable solution or I overlook something? Or maybe 
> someone had done similar?

e.g. look at the APR 0.9.4-level implementation

joe

Mime
View raw message