2004-03-06 Benjamin Kosnik <bkoz@redhat.com>
+ * include/ext/mt_allocator.h (_S_initialize): If
+ !__GTHREAD_MUTEX_INIT, then initialize _S_thread_freelist_mutex.
+
+2004-03-06 Benjamin Kosnik <bkoz@redhat.com>
+
PR libstdc++/12658
* src/locale_init.cc (locale::locale): Lock critical regions with
external mutexes.
{
if (_S_options._M_force_new)
return;
-
+
// Calculate the number of bins required based on _M_max_bytes.
// _S_bin_size is statically-initialized to one.
size_t bin_size = 1;
_S_thread_freelist_first[i - 1].next = NULL;
_S_thread_freelist_first[i - 1].id = i;
+
+ // Make sure this is initialized.
+#ifndef __GTHREAD_MUTEX_INIT
+ __GTHREAD_MUTEX_INIT_FUNCTION(&_S_thread_freelist_mutex);
+#endif
// Initialize per thread key to hold pointer to
// _S_thread_freelist.
__gthread_key_create(&_S_thread_key, _S_destroy_thread_key);
#ifdef __GTHREAD_MUTEX_INIT
__mt_alloc<_Tp>::_S_thread_freelist_mutex = __GTHREAD_MUTEX_INIT;
#else
- // XXX
__mt_alloc<_Tp>::_S_thread_freelist_mutex;
#endif
#endif