[glibmm] Glib::Main: Use std::mutex instead of Glib::Threads::Mutex.



commit dd6fd4e9030ae7e64b42d1d2b1f0b842635836ea
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Nov 26 20:47:57 2015 +0100

    Glib::Main: Use std::mutex instead of Glib::Threads::Mutex.
    
    And std::unique_lock instead of Glib::Threads::Mutex::Lock.

 glib/glibmm/main.cc |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/glib/glibmm/main.cc b/glib/glibmm/main.cc
index 53e2f49..ebc3dc5 100644
--- a/glib/glibmm/main.cc
+++ b/glib/glibmm/main.cc
@@ -63,7 +63,7 @@ struct ExtraSourceData
 std::map<const Glib::Source*, ExtraSourceData> extra_source_data;
 // Source instances may be used in different threads.
 // Accesses to extra_source_data must be thread-safe.
-Glib::Threads::Mutex extra_source_data_mutex;
+std::mutex extra_source_data_mutex;
 
 class SourceConnectionNode
 {
@@ -179,7 +179,7 @@ void SourceCallbackData::destroy_notify_callback(void* data)
 
   if(self->wrapper)
   {
-    Glib::Threads::Mutex::Lock lock(extra_source_data_mutex);
+    std::unique_lock<std::mutex> lock(extra_source_data_mutex);
     if (--extra_source_data[self->wrapper].keep_wrapper == 0)
     {
       // No other reference exists to the wrapper. Delete it!
@@ -880,13 +880,13 @@ GSource* Source::gobj_copy() const
 
 void Source::reference() const
 {
-  Glib::Threads::Mutex::Lock lock(extra_source_data_mutex);
+  std::lock_guard<std::mutex> lock(extra_source_data_mutex);
   ++extra_source_data[this].ref_count;
 }
 
 void Source::unreference() const
 {
-  Glib::Threads::Mutex::Lock lock(extra_source_data_mutex);
+  std::unique_lock<std::mutex> lock(extra_source_data_mutex);
   if (--extra_source_data[this].ref_count == 0)
   {
     GSource* const tmp_gobject = gobject_;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]