[glibmm] Thread: Use g_thread_new() instead of g_thread_create().



commit 353c3dc9f70cccc3cbe90686cd9c5e42112999a7
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Oct 21 11:10:31 2011 +0200

    Thread: Use g_thread_new() instead of g_thread_create().
    
    * glib/src/thread.[hg|ccg]: create(): Replace use of (deprecated)
      g_thread_create() with g_thread_new(), ignoring the joinable parameter.
      create(lots of parameters): Deprecate this, because the parameters are
      ignored by g_thread_create_full() now.

 ChangeLog           |    9 +++++++++
 glib/src/thread.ccg |   16 +++++-----------
 glib/src/thread.hg  |    9 +++++++--
 3 files changed, 21 insertions(+), 13 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a1bd3b3..47f373e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2011-10-21  Murray Cumming  <murrayc murrayc com>
 
+	Thread: Use g_thread_new() instead of g_thread_create().
+
+	* glib/src/thread.[hg|ccg]: create(): Replace use of (deprecated) 
+  g_thread_create() with g_thread_new(), ignoring the joinable parameter.
+  create(lots of parameters): Deprecate this, because the parameters are 
+  ignored by g_thread_create_full() now.
+
+2011-10-21  Murray Cumming  <murrayc murrayc com>
+
 	Deprecated thread_init(), Thread::joinable(), *_priotity(), etc.
 
 	* glib/src/thread.[hg|ccg]: Deprecate thread_init(), thread_supported,
diff --git a/glib/src/thread.ccg b/glib/src/thread.ccg
index 79ca2a9..1c73cee 100644
--- a/glib/src/thread.ccg
+++ b/glib/src/thread.ccg
@@ -76,25 +76,18 @@ _DEPRECATE_IFDEF_END
 /**** Glib::Thread *********************************************************/
 
 // static
-Thread* Thread::create(const sigc::slot<void>& slot, bool joinable)
+Thread* Thread::create(const sigc::slot<void>& slot, bool /* joinable */)
 {
   // Make a copy of slot on the heap
   sigc::slot_base *const slot_copy = new sigc::slot<void>(slot);
 
-  GError* error = 0;
-
-  GThread *const thread = g_thread_create(
-      &call_thread_entry_slot, slot_copy, joinable, &error);
-
-  if(error)
-  {
-    delete slot_copy;
-    Glib::Error::throw_exception(error);
-  }
+  GThread *const thread = g_thread_new(NULL, 
+      &call_thread_entry_slot, slot_copy);
 
   return reinterpret_cast<Thread*>(thread);
 }
 
+_DEPRECATE_IFDEF_START
 // static
 Thread* Thread::create(const sigc::slot<void>& slot, unsigned long stack_size,
                        bool joinable, bool bound, ThreadPriority priority)
@@ -116,6 +109,7 @@ Thread* Thread::create(const sigc::slot<void>& slot, unsigned long stack_size,
 
   return reinterpret_cast<Thread*>(thread);
 }
+_DEPRECATE_IFDEF_END
 
 // static
 Thread* Thread::self()
diff --git a/glib/src/thread.hg b/glib/src/thread.hg
index 91816cb..da9743b 100644
--- a/glib/src/thread.hg
+++ b/glib/src/thread.hg
@@ -157,12 +157,13 @@ public:
    * class concerned should not derive from sigc::trackable.
    *
    * @param slot A slot to execute in the new thread.
-   * @param joinable Should this thread be joinable?
+   * @param joinable This parameter is now ignored because Threads are now always joinable.
    * @return The new Thread* on success.
    * @throw Glib::ThreadError
    */
-  static Thread* create(const sigc::slot<void>& slot, bool joinable);
+  static Thread* create(const sigc::slot<void>& slot, bool joinable = true);
 
+_DEPRECATE_IFDEF_START
   //See http://bugzilla.gnome.org/show_bug.cgi?id=512348 about the sigc::trackable issue.
   /** Creates a new thread with the priority @a priority. The stack gets the
    * size @a stack_size or the default value for the current platform, if
@@ -205,9 +206,13 @@ public:
    * @param priority A priority for the thread.
    * @return The new Thread* on success.
    * @throw Glib::ThreadError
+   *
+   * @deprecated Use the simpler create() method instead, because all Threads 
+   * are now joinable, and bounds and priority parameters now have effect.
    */
   static Thread* create(const sigc::slot<void>& slot, unsigned long stack_size,
                         bool joinable, bool bound, ThreadPriority priority);
+_DEPRECATE_IFDEF_END
 
   /** Returns the Thread* corresponding to the calling thread.
    * @return The current thread.



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