This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: sizeof() segfault and mutex initialization?
- From: Phil Edwards <phil at jaj dot com>
- To: Stefan Olsson <stefan at snon dot net>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Thu, 20 Feb 2003 13:23:17 -0500
- Subject: Re: sizeof() segfault and mutex initialization?
- References: <3E53788C.8040906@snon.net>
On Wed, Feb 19, 2003 at 01:29:00PM +0100, Stefan Olsson wrote:
>
> 2) gthr does not implement a __gthread_mutex_init () function, only a
> static initializer. However we need to create 1-n mutexes - one per bin
> - during initialization code.
Okay.
> Is it possible/ok to call __gthread_objc_mutex_allocate?
No/no. They aren't available to C++. But we can define one ourselves,
or maybe (doubtful) add one to the gthr-*.h files.
> How can this be done?
You can do a malloc followed by __GTHREAD_MUTEX_INIT_FUNCTION. Look at
the messy code I just committed to config/cpu/generic/atomicity.h and the
bottom of src/misc-inst.cc for how some of that works.
Phil
--
I would therefore like to posit that computing's central challenge, viz. "How
not to make a mess of it," has /not/ been met.
- Edsger Dijkstra, 1930-2002