http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46455
--- Comment #20 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-11-16
11:05:44 UTC ---
OK, that will be ugly though. The cast from __gthread_recursive_mutex_t* to
__gthread_mutex_t* is not correct, because the "sema" member (the actual Win32
handle) is at a different offset in the two mutex types.
We want something like:
static inline int
__recursive_mutex_destroy(__gthread_recursive_mutex_t* __rmutex)
{
#ifdef _WIN32
__gthread_mutex_t __tmp = { };
__tmp.counter = __rmutex->counter;
__tmp.sema = __rmutex->sema;
__ghtread_mutex_t* __mutex = &__tmp;
#else
__ghtread_mutex_t* __mutex = __rmutex;
#endif
return ___gthread_mutex_destroy(__mutex);
}