Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Jan 2000 07:05:00 -0500 (EST)
From:      Daniel Eischen <eischen@vigrid.com>
To:        freebsd-hackers@FreeBSD.ORG, lists@security.za.net
Subject:   Re: Pthreads
Message-ID:  <200001131205.HAA03880@pcnet1.pcnet.com>

next in thread | raw e-mail | index | archive | help
> Quick question,
> 
> Does anyone on here know what the equivelant macro for
> PTHREAD_RECURSIVE_MUTEX_INITALIZER_NP is under freebsd?  I cant find
> anything like this in pthread.h, and Im wondering without it what do I use
> to initialize a recursive mutex.
> 
> Any advice would be appreciated

Well, the '_NP' in PTHREAD_RECURSIVE_MUTEX_INITALIZER_NP should give
you some idea.  Hint: Non-portable.

There is no PTHREAD_RECURSIVE_MUTEX_INITALIZER_NP in the POSIX standard,
and one shouldn't rely on its use.  Recursive mutexes can be easily done
by the application, just by wrapping them in a structure with an owner
and count.

That said, SUSv2 does provide a recursive mutex (unlike POSIX).  To
use a recursive mutex under FreeBSD, use:

  pthread_mutex_settype(PTHREAD_MUTEX_RECURSIVE);

Dan Eischen
eischen@vigrid.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001131205.HAA03880>