sizeof() segfault and mutex initialization?
Stefan Olsson
stefan@snon.net
Thu Feb 20 22:12:00 GMT 2003
Phil Edwards wrote:
>>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.
>
I have lots to learn about the inner workings of libstdc++ and it might
be a dumb question but what would the downside of adding this function be?
>
>
>>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.
>
>
Sorry, don't understand. As specified in gthr.h:
__GTHREAD_MUTEX_INIT_FUNCTION
some systems can't initialize a mutex without a
function call. On such systems, define this to a
function which looks like this:
void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *)
Don't define __GTHREAD_MUTEX_INIT in this case
Since gthr-posix.h defines __GTHREAD_MUTEX_INIT the
__GTHREAD_MUTEX_INIT_FUNCTION is not available.
What am I missing here?
Brgds
/Stefan
--
Experience is what you get when you were expecting something else.
More information about the Libstdc++
mailing list