This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
We've known for ages that it's not portable to do: __gthread_mutex_t tmp = __GTHREAD_MUTEX_INIT; _M_mutex = __tmp; As PR 53270 shows, the copy assignment now actually fails in C++11 mode on platforms using LinuxThreads, because the mutex has a volatile member so in C++11 mode the copy assignment operator is deleted. This patch changes <ext/concurrence.h> to use a brace-or-equals-initializer for the mutexes and condition variable in C++11 mode, allowing hppa-linux to bootstrap again and avoiding the non-portable construct everywhere (this is already the approach we take for std::mutex etc. in <mutex>). It also makes the same change to the mutex used in <ext/rope> and fixes a resource leak in that header by ensuring the mutex is destroyed when it was initialized by __gthread_mutex_init_function. PR libstdc++/53270 * include/ext/concurrence.h (__mutex, __recursive_mutex, __cond): Use NSDMI in C++11 mode. * include/ext/rope (_Refcount_Base): Likewise. Destroy mutex in destructor when initialized by function. Tested x86_64-linux, powerpc64-linux, hppa-linux and x86_64-netbsd (on the 4.7 branch instead, as netbsd doesn't bootstrap at the moment.) Committed to trunk. For 4.6.4 and 4.7.2 I plan to make a less intrusive change, #undef'ing the __GTHREAD_MUTEX_INIT, _GTHREAD_RECURSIVE_MUTEX_INIT and __GTHREAD_COND_INIT macros on hppa-linux in C++11 mode, so that the init functions are used instead. This fixes the bootstrap regression on hppa-linux without affecting other targets.
Attachment:
patch.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |