diff options
author | Murray Cumming <murrayc@murrayc.com> | 2015-11-27 09:36:37 +0100 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2015-11-28 13:30:43 +0100 |
commit | 48f07f6fdca5511546afc4bc5917616e1fa1886a (patch) | |
tree | c7c62ea87f8051c50847de179cd5d7127844ed1c /glib/glibmm/exceptionhandler.cc | |
parent | 3cda2b0798995b37ed8c6b5d0587d4320880da47 (diff) | |
download | glibmm-48f07f6fdca5511546afc4bc5917616e1fa1886a.tar.gz |
Use thread_local instead of Glib::Threads::Private.
See https://bugzilla.gnome.org/show_bug.cgi?id=757674#c15
Diffstat (limited to 'glib/glibmm/exceptionhandler.cc')
-rw-r--r-- | glib/glibmm/exceptionhandler.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/glib/glibmm/exceptionhandler.cc b/glib/glibmm/exceptionhandler.cc index df0b53e1..faad2a06 100644 --- a/glib/glibmm/exceptionhandler.cc +++ b/glib/glibmm/exceptionhandler.cc @@ -20,7 +20,6 @@ */ #include <glibmmconfig.h> -#include <glibmm/threads.h> #include <glibmm/error.h> #include <glibmm/exceptionhandler.h> #include <glib.h> @@ -35,7 +34,7 @@ typedef sigc::signal<void> HandlerList; // Each thread has its own list of exception handlers // to avoid thread synchronization problems. -static Glib::Threads::Private<HandlerList> thread_specific_handler_list; +static thread_local HandlerList* thread_specific_handler_list = nullptr; static void glibmm_exception_warning(const GError* error) @@ -86,12 +85,12 @@ namespace Glib sigc::connection add_exception_handler(const sigc::slot<void>& slot) { - HandlerList* handler_list = thread_specific_handler_list.get(); + HandlerList* handler_list = thread_specific_handler_list; if(!handler_list) { handler_list = new HandlerList(); - thread_specific_handler_list.set(handler_list); + thread_specific_handler_list = handler_list; } handler_list->slots().push_front(slot); @@ -114,7 +113,7 @@ void exception_handlers_invoke() noexcept // handled. If there are no more handlers in the list and the exception // is still unhandled, call glibmm_unexpected_exception(). - if(HandlerList *const handler_list = thread_specific_handler_list.get()) + if(HandlerList *const handler_list = thread_specific_handler_list) { HandlerList::iterator pslot = handler_list->slots().begin(); |