summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2011-10-26 22:27:48 +0200
committerMurray Cumming <murrayc@murrayc.com>2011-10-26 22:27:48 +0200
commitacf84955b9a86597e4675a0edc0848851ecafba7 (patch)
tree9e029994b833936ffbf5c113d8a1cfa972465095
parent2137668ccdad1a908d3ed275b2cf2eee8afb94cb (diff)
downloadglibmm-acf84955b9a86597e4675a0edc0848851ecafba7.tar.gz
threadpool example: Use Mutex instead of StaticMutex.
* examples/thread/threadpool.cc: The advantage of StaticMutex was that it would silently do nothing if threads were not initialized. That was never a useful distinction in this example anyway. Also remove the deprecated thread_init() call. * glib/src/thread.ccg: Mutex: Add a TODO about not using the deprecated API.
-rw-r--r--ChangeLog11
-rw-r--r--examples/thread/threadpool.cc4
-rw-r--r--glib/src/thread.ccg2
3 files changed, 13 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index bab29b79..ab3ff144 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2011-10-26 Murray Cumming <murrayc@murrayc.com>
+ threadpool example: Use Mutex instead of StaticMutex.
+
+ * examples/thread/threadpool.cc: The advantage of StaticMutex was that
+ it would silently do nothing if threads were not initialized. That
+ was never a useful distinction in this example anyway.
+ Also remove the deprecated thread_init() call.
+ * glib/src/thread.ccg: Mutex: Add a TODO about not using the deprecated
+ API.
+
+2011-10-26 Murray Cumming <murrayc@murrayc.com>
+
Fix the deprecation ifdefs.
* glib/src/thread.hg: Move the deprecation ifdefs to avoid affecting
diff --git a/examples/thread/threadpool.cc b/examples/thread/threadpool.cc
index 542c5243..6ee38477 100644
--- a/examples/thread/threadpool.cc
+++ b/examples/thread/threadpool.cc
@@ -9,7 +9,7 @@
namespace
{
-Glib::StaticMutex mutex = GLIBMM_STATIC_MUTEX_INIT;
+Glib::Mutex mutex;
void print_char(char c)
{
@@ -31,8 +31,6 @@ void print_char(char c)
int main(int, char**)
{
- Glib::thread_init();
-
Glib::ThreadPool pool (10);
for(char c = 'a'; c <= 'z'; ++c)
diff --git a/glib/src/thread.ccg b/glib/src/thread.ccg
index c50101cb..bc27592a 100644
--- a/glib/src/thread.ccg
+++ b/glib/src/thread.ccg
@@ -217,7 +217,7 @@ StaticMutex::operator Mutex&()
Mutex::Mutex()
:
- gobject_ (g_mutex_new())
+ gobject_ (g_mutex_new()) //TODO: Use a statically-allocated GMutext instead, with g_mutex_init().
{}
Mutex::~Mutex()