mt_allocator.h (_S_initialize): If !__GTHREAD_MUTEX_INIT, then initialize _S_thread_freelist_mutex.

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.

From-SVN: r79044
This commit is contained in:
Benjamin Kosnik 2004-03-07 02:17:19 +00:00 committed by Benjamin Kosnik
parent f83295bafc
commit c0bec71b82
2 changed files with 11 additions and 2 deletions

View File

@ -1,3 +1,8 @@
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> 2004-03-06 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/12658 PR libstdc++/12658

View File

@ -548,7 +548,7 @@ namespace __gnu_cxx
{ {
if (_S_options._M_force_new) if (_S_options._M_force_new)
return; return;
// Calculate the number of bins required based on _M_max_bytes. // Calculate the number of bins required based on _M_max_bytes.
// _S_bin_size is statically-initialized to one. // _S_bin_size is statically-initialized to one.
size_t bin_size = 1; size_t bin_size = 1;
@ -598,6 +598,11 @@ namespace __gnu_cxx
_S_thread_freelist_first[i - 1].next = NULL; _S_thread_freelist_first[i - 1].next = NULL;
_S_thread_freelist_first[i - 1].id = i; _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 // Initialize per thread key to hold pointer to
// _S_thread_freelist. // _S_thread_freelist.
__gthread_key_create(&_S_thread_key, _S_destroy_thread_key); __gthread_key_create(&_S_thread_key, _S_destroy_thread_key);
@ -745,7 +750,6 @@ namespace __gnu_cxx
#ifdef __GTHREAD_MUTEX_INIT #ifdef __GTHREAD_MUTEX_INIT
__mt_alloc<_Tp>::_S_thread_freelist_mutex = __GTHREAD_MUTEX_INIT; __mt_alloc<_Tp>::_S_thread_freelist_mutex = __GTHREAD_MUTEX_INIT;
#else #else
// XXX
__mt_alloc<_Tp>::_S_thread_freelist_mutex; __mt_alloc<_Tp>::_S_thread_freelist_mutex;
#endif #endif
#endif #endif