This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
RE: recursive mutex?
- To: "'Carlo Wood'" <carlo at alinoe dot com>, libstdc++ at gcc dot gnu dot org
- Subject: RE: recursive mutex?
- From: Michael VanLoon <MichaelV at EDIFECS dot COM>
- Date: Wed, 17 Oct 2001 18:38:03 -0700
It's funny because I just came across this with Forte C++ on Solaris. It
seems Solaris 2.8 and 2.7 pthreads implementation have an option for
recursive on the pthreads mutex, but Solaris 2.6 (and older I assume) does
not.
Is this system-specific? And/or maybe something introduced in a recent
revision of pthreads that wasn't in earlier versions?
If you write a wrapper class, it's trivial to make your wrapper recursive
and have it call the underlying mutex non-recursively. (And I wouldn't
program without a wrapper in a C++ paradigm anyway, since the C-style
threading methods don't facilitate automatic construction/destruction.)
For what it's worth, here's the function call to set the pthread mutex to
recursive on Solaris 2.8:
int iRet = pthread_mutex_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
> -----Original Message-----
> From: Carlo Wood [mailto:carlo@alinoe.com]
> Sent: Wednesday, October 17, 2001 6:12 PM
> To: libstdc++@gcc.gnu.org
> Subject: recursive mutex?
>
>
> I need a recursive mutex lock, but it seems the STL/libstdc++ doesn't
> already have one. Or do I miss something?
>
> --
> Carlo Wood <carlo@alinoe.com>
>