diff options
author | Benjamin Kosnik <bkoz@redhat.com> | 2004-03-07 02:17:19 +0000 |
---|---|---|
committer | Benjamin Kosnik <bkoz@gcc.gnu.org> | 2004-03-07 02:17:19 +0000 |
commit | c0bec71b82aa6503c7478ff4ac409c197c26e9c6 (patch) | |
tree | caad79ef327b6c35aa3189468ea18f7fac73dd59 | |
parent | f83295bafc73a70666d5d67e05918b0e6882402c (diff) | |
download | gcc-c0bec71b82aa6503c7478ff4ac409c197c26e9c6.zip gcc-c0bec71b82aa6503c7478ff4ac409c197c26e9c6.tar.gz gcc-c0bec71b82aa6503c7478ff4ac409c197c26e9c6.tar.bz2 |
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
-rw-r--r-- | libstdc++-v3/ChangeLog | 5 | ||||
-rw-r--r-- | libstdc++-v3/include/ext/mt_allocator.h | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 2f36a46..36decc1 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,10 @@ 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. diff --git a/libstdc++-v3/include/ext/mt_allocator.h b/libstdc++-v3/include/ext/mt_allocator.h index 1bcff03..7b42300 100644 --- a/libstdc++-v3/include/ext/mt_allocator.h +++ b/libstdc++-v3/include/ext/mt_allocator.h @@ -548,7 +548,7 @@ namespace __gnu_cxx { 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; @@ -598,6 +598,11 @@ namespace __gnu_cxx _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); @@ -745,7 +750,6 @@ namespace __gnu_cxx #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 |