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



commit 7dda0e147e0e524bf483cf317aece284c37c0f1e
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Nov 6 13:43:49 2015 +0100

    threadpool example: Use std::mutex instead of Glib::Threads::Mutex.
    
    And std::lock_guard<> instead of Glib::Threads::Mutex::Lock.

 examples/thread/threadpool.cc |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/examples/thread/threadpool.cc b/examples/thread/threadpool.cc
index 557997f..e5cd68c 100644
--- a/examples/thread/threadpool.cc
+++ b/examples/thread/threadpool.cc
@@ -1,6 +1,7 @@
 
 #include <iostream>
-#include <glibmm/threads.h>
+#include <thread>
+#include <mutex>
 #include <glibmm/random.h>
 #include <glibmm/threadpool.h>
 #include <glibmm/timer.h>
@@ -9,7 +10,7 @@
 namespace
 {
 
-Glib::Threads::Mutex mutex;
+std::mutex mutex;
 
 void print_char(char c)
 {
@@ -18,7 +19,7 @@ void print_char(char c)
   for(auto i = 0; i < 100; ++i)
   {
     {
-      Glib::Threads::Mutex::Lock lock (mutex);
+      std::lock_guard<std::mutex> lock (mutex);
       std::cout << c;
       std::cout.flush();
     }


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