[glibmm] Sanitize the Glib::Cond usage example



commit 5b995955d4bbd97041aeda2780b1f68419bbb55e
Author: Daniel Elstner <danielk openismus com>
Date:   Thu Sep 3 16:34:37 2009 +0200

    Sanitize the Glib::Cond usage example
    
    * glib/src/thread.hg (Glib::Cond): Sanitize the usage example.

 ChangeLog          |    6 ++++++
 glib/src/thread.hg |   30 +++++++++++++++---------------
 2 files changed, 21 insertions(+), 15 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ab9b827..4c01817 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-09-03  Daniel Elstner  <danielk openismus com>
+
+	Sanitize the Glib::Cond usage example
+
+	* glib/src/thread.hg (Glib::Cond): Sanitize the usage example.
+
 2009-09-02  Daniel Elstner  <danielk openismus com>
 
 	Remove sigc from the Doxygen excluded symbols
diff --git a/glib/src/thread.hg b/glib/src/thread.hg
index 60696fd..f02a640 100644
--- a/glib/src/thread.hg
+++ b/glib/src/thread.hg
@@ -589,28 +589,28 @@ private:
  * they can signal the @a Cond, such that the waiting thread is woken up.
  * @par Usage example:
  * @code
- * Glib::Cond data_cond;
+ * Glib::Cond  data_cond;
  * Glib::Mutex data_mutex;
- * void* current_data = NULL;
- * 
- * void push_data (void* data)
+ * void* current_data = 0;
+ *
+ * void push_data(void* data)
  * {
- *   data_mutex.lock();
+ *   Glib::Mutex::Lock lock (data_mutex);
+ *
  *   current_data = data;
  *   data_cond.signal();
- *   data_mutex.unlock();
  * }
- * 
- * void* pop_data ()
+ *
+ * void* pop_data()
  * {
- *   void* data;
- * 
- *   data_mutex.lock();
+ *   Glib::Mutex::Lock lock (data_mutex);
+ *
  *   while (!current_data)
- *       data_cond.wait(data_mutex);
- *   data = current_data;
- *   current_data = NULL;
- *   data_mutex.unlock();
+ *     data_cond.wait(data_mutex);
+ *
+ *   void *const data = current_data;
+ *   current_data = 0;
+ *
  *   return data;
  * }
  * @endcode



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