[glibmm] threadpool example: Use std::mutex instead of Glib::Threads::Mutex.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] threadpool example: Use std::mutex instead of Glib::Threads::Mutex.
- Date: Thu, 26 Nov 2015 10:06:42 +0000 (UTC)
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]