diff options
author | Murray Cumming <murrayc@murrayc.com> | 2011-10-21 11:10:31 +0200 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2011-10-21 11:10:31 +0200 |
commit | 353c3dc9f70cccc3cbe90686cd9c5e42112999a7 (patch) | |
tree | 02934827c9274c828f1b546d083a76590f3d1767 | |
parent | 9f2876360109b88cbf919aab1e02eab161f1d268 (diff) | |
download | glibmm-353c3dc9f70cccc3cbe90686cd9c5e42112999a7.tar.gz |
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.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | glib/src/thread.ccg | 16 | ||||
-rw-r--r-- | glib/src/thread.hg | 9 |
3 files changed, 21 insertions, 13 deletions
@@ -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 79ca2a98..1c73ceee 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 91816cb0..da9743b0 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. |