[niepce/gtk3] Revert a93cd9fb993ccdaec4db385e005c8227192037ec as it requires glimm 2.31



commit c058875b2a04bcdbd841ce41af41b26959acfd76
Author: Hub Figuiere <hub figuiere net>
Date:   Wed Dec 7 22:18:34 2011 -0800

    Revert a93cd9fb993ccdaec4db385e005c8227192037ec as it requires glimm 2.31

 src/fwk/toolkit/notification.hpp         |    4 +-
 src/fwk/utils/db/sqlite/sqlitecnxdrv.cpp |   32 +++++++++++++++---------------
 src/fwk/utils/db/sqlite/sqlitecnxdrv.hpp |    4 +-
 src/fwk/utils/init.cpp                   |    5 +++-
 src/fwk/utils/mtqueue.hpp                |    4 +-
 src/fwk/utils/thread.cpp                 |    2 +-
 src/fwk/utils/thread.hpp                 |    6 ++--
 src/fwk/utils/worker.hpp                 |   14 ++++++------
 8 files changed, 37 insertions(+), 34 deletions(-)
---
diff --git a/src/fwk/toolkit/notification.hpp b/src/fwk/toolkit/notification.hpp
index 4c8c4ba..f960320 100644
--- a/src/fwk/toolkit/notification.hpp
+++ b/src/fwk/toolkit/notification.hpp
@@ -27,7 +27,7 @@
 #include <tr1/memory>
 #include <boost/any.hpp>
 
-#include <glibmm/threads.h>
+#include <glibmm/thread.h>
 
 namespace fwk {
 
@@ -36,7 +36,7 @@ namespace fwk {
 	{
 	public:
 		typedef std::tr1::shared_ptr<Notification> Ptr;
-	  typedef Glib::Threads::RecMutex mutex_t;
+		typedef Glib::RecMutex mutex_t;
 
 		Notification(int _type)
 			: m_type(_type)
diff --git a/src/fwk/utils/db/sqlite/sqlitecnxdrv.cpp b/src/fwk/utils/db/sqlite/sqlitecnxdrv.cpp
index 490e542..94e4e93 100644
--- a/src/fwk/utils/db/sqlite/sqlitecnxdrv.cpp
+++ b/src/fwk/utils/db/sqlite/sqlitecnxdrv.cpp
@@ -211,7 +211,7 @@ namespace db { namespace sqlite {
 
 		SqliteCnxDrv::SqliteCnxDrv (sqlite3 *a_sqlite_handle)
 		{
-      Glib::Threads::RecMutex::Lock lock(m_mutex);
+      Glib::RecMutex::Lock lock(m_mutex);
 			THROW_IF_FAIL (a_sqlite_handle) ;
 			m_priv.reset (new Priv) ;
 			m_priv->sqlite.reset (a_sqlite_handle) ;
@@ -219,7 +219,7 @@ namespace db { namespace sqlite {
 
 		SqliteCnxDrv::~SqliteCnxDrv ()
 		{
-      Glib::Threads::RecMutex::Lock lock(m_mutex);
+      Glib::RecMutex::Lock lock(m_mutex);
 			close () ;
 			m_priv.reset(NULL);
 		}
@@ -235,7 +235,7 @@ namespace db { namespace sqlite {
 		const char*
 		SqliteCnxDrv::get_last_error () const
 		{
-      Glib::Threads::RecMutex::Lock lock(m_mutex);
+      Glib::RecMutex::Lock lock(m_mutex);
 			if (m_priv && m_priv->sqlite) {
 				return sqlite3_errmsg (m_priv->sqlite.get ());
 			}
@@ -266,7 +266,7 @@ namespace db { namespace sqlite {
 		bool
 		SqliteCnxDrv::execute_statement (const SQLStatement &a_statement)
 		{
-      Glib::Threads::RecMutex::Lock lock(m_mutex);
+      Glib::RecMutex::Lock lock(m_mutex);
 
 		  THROW_IF_FAIL (m_priv && m_priv->sqlite) ;
 		  DBG_OUT("sql string: %s", a_statement.to_string().c_str()) ;
@@ -370,7 +370,7 @@ namespace db { namespace sqlite {
 		bool
 		SqliteCnxDrv::should_have_data () const
 		{
-      Glib::Threads::RecMutex::Lock lock(m_mutex);
+      Glib::RecMutex::Lock lock(m_mutex);
 			THROW_IF_FAIL (m_priv) ;
 
 			if (get_number_of_columns () > 0)
@@ -381,7 +381,7 @@ namespace db { namespace sqlite {
 		bool
 		SqliteCnxDrv::read_next_row ()
 		{
-      Glib::Threads::RecMutex::Lock lock(m_mutex);
+      Glib::RecMutex::Lock lock(m_mutex);
 			THROW_IF_FAIL (m_priv) ;
 			if (m_priv->cur_stmt) {
 				if (m_priv->last_execution_result == SQLITE_DONE) {
@@ -404,7 +404,7 @@ namespace db { namespace sqlite {
 		unsigned int
 		SqliteCnxDrv::get_number_of_columns () const
 		{
-      Glib::Threads::RecMutex::Lock lock(m_mutex);
+      Glib::RecMutex::Lock lock(m_mutex);
 			THROW_IF_FAIL (m_priv) ;
 			if (!m_priv->cur_stmt)
 				return 0 ;
@@ -415,7 +415,7 @@ namespace db { namespace sqlite {
 		SqliteCnxDrv::get_column_content (uint32_t a_offset,
 										  fwk::Buffer &a_column_content) const
 		{
-      Glib::Threads::RecMutex::Lock lock(m_mutex);
+      Glib::RecMutex::Lock lock(m_mutex);
 			THROW_IF_FAIL (m_priv) ;
 
 			RETURN_VAL_IF_FAIL (m_priv->check_offset (a_offset), false) ;
@@ -429,7 +429,7 @@ namespace db { namespace sqlite {
 		SqliteCnxDrv::get_column_content (uint32_t a_offset,
 										  int32_t &a_column_content) const
 		{
-      Glib::Threads::RecMutex::Lock lock(m_mutex);
+      Glib::RecMutex::Lock lock(m_mutex);
 			THROW_IF_FAIL (m_priv) ;
 
 			RETURN_VAL_IF_FAIL (m_priv->check_offset (a_offset), false) ;
@@ -447,7 +447,7 @@ namespace db { namespace sqlite {
 		SqliteCnxDrv::get_column_content (uint32_t a_offset,
 										  int64_t &a_column_content) const
 		{
-      Glib::Threads::RecMutex::Lock lock(m_mutex);
+      Glib::RecMutex::Lock lock(m_mutex);
 			THROW_IF_FAIL (m_priv) ;
 
 			RETURN_VAL_IF_FAIL (m_priv->check_offset (a_offset), false) ;
@@ -466,7 +466,7 @@ namespace db { namespace sqlite {
 		SqliteCnxDrv::get_column_content (uint32_t a_offset,
 										  double& a_column_content) const
 		{
-      Glib::Threads::RecMutex::Lock lock(m_mutex);
+      Glib::RecMutex::Lock lock(m_mutex);
 			THROW_IF_FAIL (m_priv) ;
 			RETURN_VAL_IF_FAIL (m_priv->check_offset (a_offset), false) ;
 			int type = sqlite3_column_type (m_priv->cur_stmt, a_offset) ;
@@ -482,7 +482,7 @@ namespace db { namespace sqlite {
 		SqliteCnxDrv::get_column_content (uint32_t a_offset,
 										  std::string& a_column_content) const
 		{
-      Glib::Threads::RecMutex::Lock lock(m_mutex);
+      Glib::RecMutex::Lock lock(m_mutex);
 			THROW_IF_FAIL (m_priv) ;
 
 			RETURN_VAL_IF_FAIL (m_priv->check_offset (a_offset), false) ;
@@ -506,7 +506,7 @@ namespace db { namespace sqlite {
 		SqliteCnxDrv::get_column_type (uint32_t a_offset,
 									   enum ColumnType &a_type) const
 		{
-      Glib::Threads::RecMutex::Lock lock(m_mutex);
+      Glib::RecMutex::Lock lock(m_mutex);
 			THROW_IF_FAIL (m_priv) ;
 			RETURN_VAL_IF_FAIL (m_priv->check_offset (a_offset), false) ;
 			int type = sqlite3_column_type (m_priv->cur_stmt, a_offset) ;
@@ -538,7 +538,7 @@ namespace db { namespace sqlite {
 		bool
 		SqliteCnxDrv::get_column_name (uint32_t a_offset, fwk::Buffer &a_name) const
 		{
-      Glib::Threads::RecMutex::Lock lock(m_mutex);
+      Glib::RecMutex::Lock lock(m_mutex);
 			THROW_IF_FAIL (m_priv) ;
 			RETURN_VAL_IF_FAIL (m_priv->check_offset (a_offset), false) ;
 			const char* name = sqlite3_column_name (m_priv->cur_stmt, a_offset) ;
@@ -551,7 +551,7 @@ namespace db { namespace sqlite {
 		void
 		SqliteCnxDrv::close ()
 		{
-      Glib::Threads::RecMutex::Lock lock(m_mutex);
+      Glib::RecMutex::Lock lock(m_mutex);
 			THROW_IF_FAIL (m_priv) ;
 
 			if (m_priv->sqlite) {
@@ -565,7 +565,7 @@ namespace db { namespace sqlite {
 		int64_t
 		SqliteCnxDrv::last_row_id()
 		{
-      Glib::Threads::RecMutex::Lock lock(m_mutex);
+      Glib::RecMutex::Lock lock(m_mutex);
 			THROW_IF_FAIL (m_priv);
 			if (m_priv->sqlite) {
 				return sqlite3_last_insert_rowid(m_priv->sqlite.get());
diff --git a/src/fwk/utils/db/sqlite/sqlitecnxdrv.hpp b/src/fwk/utils/db/sqlite/sqlitecnxdrv.hpp
index 8d01e61..4465106 100644
--- a/src/fwk/utils/db/sqlite/sqlitecnxdrv.hpp
+++ b/src/fwk/utils/db/sqlite/sqlitecnxdrv.hpp
@@ -29,7 +29,7 @@
 
 #include <boost/scoped_ptr.hpp>
 
-#include <glibmm/threads.h>
+#include <glibmm/thread.h>
 
 #include "fwk/utils/db/iconnectiondriver.hpp"
 
@@ -44,7 +44,7 @@ class SqliteCnxDrv: public db::IConnectionDriver {
     struct Priv ;
     friend class SqliteCnxMgrDrv ;
     boost::scoped_ptr<Priv> m_priv ;
-    mutable Glib::Threads::RecMutex m_mutex;
+    mutable Glib::RecMutex m_mutex;
 
     //forbid copy
     SqliteCnxDrv (const SqliteCnxDrv &) ;
diff --git a/src/fwk/utils/init.cpp b/src/fwk/utils/init.cpp
index 5238541..0f8143f 100644
--- a/src/fwk/utils/init.cpp
+++ b/src/fwk/utils/init.cpp
@@ -18,7 +18,7 @@
  */
 
 
-#include <glibmm/threads.h>
+#include <glibmm/thread.h>
 #include <giomm/init.h>
 
 
@@ -31,6 +31,9 @@ namespace utils {
 void init()
 {
   Gio::init();
+  if(!Glib::thread_supported()) {
+    Glib::thread_init();
+  }
 }
 
 
diff --git a/src/fwk/utils/mtqueue.hpp b/src/fwk/utils/mtqueue.hpp
index 1f73bc2..76f161a 100644
--- a/src/fwk/utils/mtqueue.hpp
+++ b/src/fwk/utils/mtqueue.hpp
@@ -23,7 +23,7 @@
 #define __FWK_UTILS_MTQUEUE_H__
 
 #include <deque>
-#include <glibmm/threads.h>
+#include <glibmm/thread.h>
 
 namespace fwk {
 
@@ -36,7 +36,7 @@ namespace fwk {
 	class MtQueue
 	{
 	public:
-	  typedef Glib::Threads::RecMutex mutex_t;
+		typedef Glib::RecMutex mutex_t;
 		typedef T              value_type;
 
 		MtQueue();
diff --git a/src/fwk/utils/thread.cpp b/src/fwk/utils/thread.cpp
index ef84969..16e1837 100644
--- a/src/fwk/utils/thread.cpp
+++ b/src/fwk/utils/thread.cpp
@@ -38,7 +38,7 @@ Thread::~Thread()
 
 void Thread::start()
 {
-    m_thrd = Glib::Threads::Thread::create(sigc::mem_fun(*this, &Thread::main), true);
+    m_thrd = Glib::Thread::create(sigc::mem_fun(*this, &Thread::main), true);
 // TODO add this thread to a manager for task management.
 //		thrd->join();
 }
diff --git a/src/fwk/utils/thread.hpp b/src/fwk/utils/thread.hpp
index 0067894..0134dac 100644
--- a/src/fwk/utils/thread.hpp
+++ b/src/fwk/utils/thread.hpp
@@ -24,7 +24,7 @@
 
 #include <string>
 
-#include <glibmm/threads.h>
+#include <glibmm/thread.h>
 
 
 namespace fwk {
@@ -43,10 +43,10 @@ protected:
     void start();
     virtual void main() = 0;
     volatile bool m_terminated;
-    Glib::Threads::Thread * thread() const
+    Glib::Thread * thread() const
         { return m_thrd; }
 private:
-    Glib::Threads::Thread *       m_thrd;
+    Glib::Thread *       m_thrd;
 };
 
 }
diff --git a/src/fwk/utils/worker.hpp b/src/fwk/utils/worker.hpp
index 3cb9828..da46f0d 100644
--- a/src/fwk/utils/worker.hpp
+++ b/src/fwk/utils/worker.hpp
@@ -51,8 +51,8 @@ protected:
     queue_t      m_tasks;
 private:
     virtual void execute(const T & _op) = 0;
-    Glib::Threads::Mutex m_q_mutex;
-    Glib::Threads::Cond m_wait_cond;
+    Glib::Mutex m_q_mutex;
+    Glib::Cond m_wait_cond;
 };
 
 template <class T>
@@ -67,7 +67,7 @@ Worker<T>::~Worker()
 {
     m_tasks.clear();
     {
-        Glib::Threads::Mutex::Lock lock(m_q_mutex);
+        Glib::Mutex::Lock lock(m_q_mutex);
         m_terminated = true;
         m_wait_cond.broadcast();
     }
@@ -85,7 +85,7 @@ void Worker<T>::main()
         {
             // make sure we terminate the thread before we unlock
             // the task queue.
-            Glib::Threads::Mutex::Lock lock(m_q_mutex);
+            Glib::Mutex::Lock lock(m_q_mutex);
             if(!m_tasks.empty()) {
                 op = m_tasks.pop();
             }
@@ -95,7 +95,7 @@ void Worker<T>::main()
             execute(op);
         }
 
-        Glib::Threads::Mutex::Lock lock(m_q_mutex);
+        Glib::Mutex::Lock lock(m_q_mutex);
         if(m_tasks.empty()) {
             m_wait_cond.wait(m_q_mutex);
         }
@@ -105,7 +105,7 @@ void Worker<T>::main()
 template <class T>
 void Worker<T>::schedule(const T & _op)
 {
-    Glib::Threads::Mutex::Lock lock(m_q_mutex);
+    Glib::Mutex::Lock lock(m_q_mutex);
     m_tasks.add(_op);
     m_wait_cond.broadcast();
 }
@@ -113,7 +113,7 @@ void Worker<T>::schedule(const T & _op)
 template <class T>
 void Worker<T>::clear()
 {
-    Glib::Threads::Mutex::Lock lock(m_q_mutex);
+    Glib::Mutex::Lock lock(m_q_mutex);
     m_tasks.clear();
 }
 



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