sizeof() segfault and mutex initialization?
Benjamin Kosnik
bkoz@redhat.com
Thu Feb 20 05:24:00 GMT 2003
>_S_thread_freelist_mutex = (__gthread_mutex_t*)malloc (sizeof
>(__gthread_mutex_t));
>
>It's possible to do sizeof on structs defined inside the template class,
>but not on for instance int or - what we really want to do -
>__gthread_mutex_t. This seems to be the PR7112. Any work arounds?
Is __gthread_mutex_t a forward declaration or well defined at this point?
Does the size of __gthread_mutex_t change at any point? If not, do you
need to do this inside a templatized class?
7112 is fixed in mainline. If you are having problems, I suggest, as a
first step, posting a small, self-contained test case.
Again, think small.
>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. How can this be done? Is it possible/ok to
>call __gthread_objc_mutex_allocate?
Ouch. Loren?
-benjamin
More information about the Libstdc++
mailing list