[glibmm] Threads::Thread::create(): Update the documentation.



commit bc3c56340fdf8721563480f51776494809caeeeb
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Wed Feb 20 09:21:02 2013 +0100

    Threads::Thread::create(): Update the documentation.
    
    * examples/thread/thread.cc: Don't derive from sigc::trackable.
    * glib/src/threads.hg: create(): Describe how sigc::trackable-derived classes
    can be used in a thread-safe way. Bug #512348.

 ChangeLog                 |    8 ++++++++
 examples/thread/thread.cc |    2 +-
 glib/src/threads.hg       |   17 +++++++++++------
 3 files changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d22d716..030dcf1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-02-20  Kjell Ahlstedt  <kjell ahlstedt bredband net>
+
+       Threads::Thread::create(): Update the documentation.
+
+       * examples/thread/thread.cc: Don't derive from sigc::trackable.
+       * glib/src/threads.hg: create(): Describe how sigc::trackable-derived classes
+       can be used in a thread-safe way. Bug #512348.
+
 2013-01-30  Kjell Ahlstedt  <kjell ahlstedt bredband net>
 
        Predefine G_OS_UNIX or G_OS_WIN32 in Doxygen's configuration file.
diff --git a/examples/thread/thread.cc b/examples/thread/thread.cc
index 6cfa904..ad7cfeb 100644
--- a/examples/thread/thread.cc
+++ b/examples/thread/thread.cc
@@ -9,7 +9,7 @@
 namespace
 {
 
-class MessageQueue : public sigc::trackable
+class MessageQueue
 {
 public:
   MessageQueue();
diff --git a/glib/src/threads.hg b/glib/src/threads.hg
index 35b1643..de83e35 100644
--- a/glib/src/threads.hg
+++ b/glib/src/threads.hg
@@ -72,6 +72,9 @@ public:
   class Exit;
 
   //See http://bugzilla.gnome.org/show_bug.cgi?id=512348 about the sigc::trackable issue.
+  // TODO: At the next ABI break, consider changing const sigc::slot<void>& slot
+  // to const std::function<void()>& func, if it can be assumed that all supported
+  // compilers understand the C++11 template class std::function<>.
   /** Creates a new thread.
    * You can wait for this thread's termination by calling join().
    *
@@ -79,9 +82,10 @@ public:
    * pass additional arguments using sigc::bind().  If the thread was created
    * successfully, it is returned, otherwise a Threads::ThreadError exception is thrown.
    *
-   * Because sigc::trackable is not thread safe, if the slot represents a
-   * non-static class method (that is, it is created by sigc::mem_fun()), the
-   * class concerned should not derive from sigc::trackable.
+   * Because sigc::trackable is not thread-safe, if the slot represents a
+   * non-static class method created by sigc::mem_fun(), the class concerned
+   * should not derive from sigc::trackable. You can use, say, boost::bind() or,
+   * in C++11, std::bind() or a C++11 lambda expression instead of sigc::mem_fun().
    *
    * @param slot A slot to execute in the new thread.
    * @return The new Thread* on success.
@@ -99,9 +103,10 @@ public:
    * pass additional arguments using sigc::bind().  If the thread was created
    * successfully, it is returned, otherwise a Threads::ThreadError exception is thrown.
    *
-   * Because sigc::trackable is not thread safe, if the slot represents a
-   * non-static class method (that is, it is created by sigc::mem_fun()), the
-   * class concerned should not derive from sigc::trackable.
+   * Because sigc::trackable is not thread-safe, if the slot represents a
+   * non-static class method created by sigc::mem_fun(), the class concerned
+   * should not derive from sigc::trackable. You can use, say, boost::bind() or,
+   * in C++11, std::bind() or a C++11 lambda expression instead of sigc::mem_fun().
    *
    * The @a name can be useful for discriminating threads in a debugger.
    * Some systems restrict the length of @a name to 16 bytes.


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