diff options
author | ljrittle <ljrittle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-06-24 06:34:34 +0000 |
---|---|---|
committer | ljrittle <ljrittle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-06-24 06:34:34 +0000 |
commit | 819c2b1db5a3f78d671f15620450dcea2acc9518 (patch) | |
tree | 0be11284ee79b07a95dc0f66a15c38c017d1d2a0 /libstdc++-v3/include/ext | |
parent | fee0876999ad5bf7644136808e582335af99de38 (diff) | |
download | gcc-819c2b1db5a3f78d671f15620450dcea2acc9518.tar.gz |
* include/ext/mt_allocator.h: Portability.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@68406 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/ext')
-rw-r--r-- | libstdc++-v3/include/ext/mt_allocator.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libstdc++-v3/include/ext/mt_allocator.h b/libstdc++-v3/include/ext/mt_allocator.h index 1e95b55f467..cd3b273ad91 100644 --- a/libstdc++-v3/include/ext/mt_allocator.h +++ b/libstdc++-v3/include/ext/mt_allocator.h @@ -613,13 +613,15 @@ namespace __gnu_cxx if (!_S_bin[bin].mutex) __throw_bad_alloc(); - /* - * This is not only ugly - it's extremly non-portable! - * However gthr.h does not currently provide a - * __gthread_mutex_init() call. The correct solution to - * this problem needs to be discussed. - */ - pthread_mutex_init(_S_bin[bin].mutex, NULL); +#ifdef __GTHREAD_MUTEX_INIT + { + // Do not copy a POSIX/gthr mutex once in use. + __gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT; + *_S_bin[bin].mutex = __tmp; + } +#else + { __GTHREAD_MUTEX_INIT_FUNCTION (_S_bin[bin].mutex); } +#endif #endif for (size_t thread = 0; thread <= _S_max_threads; thread++) |