sizeof() segfault and mutex initialization?

Phil Edwards phil@jaj.com
Thu Feb 20 18:23:00 GMT 2003


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



More information about the Libstdc++ mailing list