Blob Blame History Raw
diff -N -u -r abiword-plugins-2.6.0.orig/tools/abicollab/backends/tcp/xp/IOClientHandler.h abiword-plugins-2.6.0/tools/abicollab/backends/tcp/xp/IOClientHandler.h
--- abiword-plugins-2.6.0.orig/tools/abicollab/backends/tcp/xp/IOClientHandler.h	2008-03-18 23:18:08.000000000 +0100
+++ abiword-plugins-2.6.0/tools/abicollab/backends/tcp/xp/IOClientHandler.h	2008-03-29 01:53:52.000000000 +0100
@@ -20,7 +20,6 @@
 #define __IO_CLIENT_HANDLER__
 
 #include <boost/bind.hpp>
-#include <boost/thread.hpp>
 #include <boost/utility.hpp>
 #include <asio.hpp>
 
@@ -69,7 +68,7 @@
 		UT_return_if_fail(work == NULL);
 		
 		work = new asio::io_service::work(io_service);
-		thread = new boost::thread(IOServiceThread(io_service));
+		thread = new asio::thread(IOServiceThread(io_service));
 		
 		// TODO: catch exceptions
 		asio::ip::tcp::resolver::iterator iterator(resolver.resolve(query));
@@ -79,7 +78,7 @@
 
 private:
 	asio::io_service					io_service;
-	boost::thread*						thread;
+	asio::thread*						thread;
 	asio::io_service::work*				work;
 	asio::ip::tcp::resolver				resolver;
 	asio::ip::tcp::resolver::query		query;
diff -N -u -r abiword-plugins-2.6.0.orig/tools/abicollab/backends/tcp/xp/IOServerHandler.h abiword-plugins-2.6.0/tools/abicollab/backends/tcp/xp/IOServerHandler.h
--- abiword-plugins-2.6.0.orig/tools/abicollab/backends/tcp/xp/IOServerHandler.h	2008-03-18 23:18:08.000000000 +0100
+++ abiword-plugins-2.6.0/tools/abicollab/backends/tcp/xp/IOServerHandler.h	2008-03-29 01:53:52.000000000 +0100
@@ -22,7 +22,6 @@
 #include "ut_debugmsg.h"
 
 #include <boost/bind.hpp>
-#include <boost/thread.hpp>
 #include <boost/utility.hpp>
 #include <asio.hpp>
 
@@ -47,7 +46,7 @@
 	{
 		work = new asio::io_service::work(io_service);
 		m_pAcceptor = new asio::ip::tcp::acceptor(io_service, endpoint);
-		boost::thread thread(iot);
+		asio::thread thread(iot);
 	}
 	
 	virtual ~IOServerHandler()
diff -N -u -r abiword-plugins-2.6.0.orig/tools/abicollab/backends/tcp/xp/Session.h abiword-plugins-2.6.0/tools/abicollab/backends/tcp/xp/Session.h
--- abiword-plugins-2.6.0.orig/tools/abicollab/backends/tcp/xp/Session.h	2008-03-18 23:18:08.000000000 +0100
+++ abiword-plugins-2.6.0/tools/abicollab/backends/tcp/xp/Session.h	2008-03-29 01:53:52.000000000 +0100
@@ -20,6 +20,7 @@
 #define __SESSION__
 
 #include <deque>
+#include <backends/xp/lock.h>
 
 class TCPAccountHandler;
 
@@ -48,7 +49,7 @@
 	void push(int size, char* data)
 	{
 		{
-			boost::mutex::scoped_lock lock(queue_protector); 
+			abicollab::scoped_lock lock(queue_protector); 
 			incoming.push_back( std::pair<int, char*>(size, data) );
 		}
 		signal();
@@ -62,7 +63,7 @@
 		if (incoming.size() == 0)
 			return false;
 		{
-			boost::mutex::scoped_lock lock(queue_protector); 
+			abicollab::scoped_lock lock(queue_protector); 
 			std::pair<int, char*> p = incoming.front();
 			size = p.first;
 			*data = p.second;
@@ -218,7 +219,7 @@
 	}
 
 	asio::ip::tcp::socket					socket;
-	boost::mutex 							queue_protector;
+	abicollab::mutex 							queue_protector;
 	std::deque< std::pair<int, char*> >		incoming;
 	std::deque< std::pair<int, char*> >		outgoing;
 
diff -N -u -r abiword-plugins-2.6.0.orig/tools/abicollab/backends/xp/lock.h abiword-plugins-2.6.0/tools/abicollab/backends/xp/lock.h
--- abiword-plugins-2.6.0.orig/tools/abicollab/backends/xp/lock.h	1970-01-01 01:00:00.000000000 +0100
+++ abiword-plugins-2.6.0/tools/abicollab/backends/xp/lock.h	2008-03-29 01:53:52.000000000 +0100
@@ -0,0 +1,94 @@
+/* Copyright (C) 2008 by Marc Maurer <uwog@uwog.net>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef WIN32
+#include <pthread.h>
+#endif
+
+namespace abicollab
+{
+
+class scoped_lock;
+
+class mutex
+{
+friend class scoped_lock;
+
+public:
+	mutex()
+	{
+#ifdef WIN32
+		repr = CreateMutex(0, FALSE, 0);
+#else
+		pthread_mutex_init(&repr, NULL);
+#endif
+	}
+
+	~mutex()
+	{
+#ifdef WIN32
+		CloseHandle(repr);
+#else
+		pthread_mutex_destroy(&repr);
+#endif
+	}
+
+private:
+	// we are noncopyable
+	mutex( const mutex& );
+	const mutex& operator=( const mutex& );
+
+#ifdef WIN32
+	HANDLE repr;
+#else
+	pthread_mutex_t repr;
+#endif
+};
+
+class scoped_lock
+{
+public:
+	scoped_lock(mutex& mutex)
+		: m_mutex(mutex)
+	{
+#ifdef WIN32
+		WaitForSingleObject(m_mutex.repr, INFINITE);
+#else
+		pthread_mutex_lock(&m_mutex.repr);
+#endif
+	}
+
+	~scoped_lock()
+	{
+#ifdef WIN32
+		ReleaseMutex(m_mutex.repr);
+#else
+		pthread_mutex_unlock(&m_mutex.repr);
+#endif
+	}
+
+private:
+	// we are noncopyable
+	scoped_lock( const scoped_lock& );
+	const scoped_lock& operator=( const scoped_lock& );
+
+	mutex& m_mutex;
+};
+
+}
+
diff -N -u -r abiword-plugins-2.6.0.orig/tools/abicollab/plugin.m4 abiword-plugins-2.6.0/tools/abicollab/plugin.m4
--- abiword-plugins-2.6.0.orig/tools/abicollab/plugin.m4	2008-03-18 23:18:08.000000000 +0100
+++ abiword-plugins-2.6.0/tools/abicollab/plugin.m4	2008-03-29 01:53:52.000000000 +0100
@@ -75,7 +75,6 @@
 
 # check for various boost libs
 AX_BOOST_BASE([1.33.1])
-AX_BOOST_THREAD
 
 # check for asio
 AC_LANG_PUSH(C++)
@@ -134,7 +133,7 @@
 ])
 if test "x$abicollab_handler_tcp" = "xyes" ; then
 	ABICOLLAB_TCP_CPPFLAGS="-DABICOLLAB_HANDLER_TCP $ABICOLLAB_ASIO_CPPFLAGS"
-	ABICOLLAB_TCP_LIBS="$BOOST_THREAD_LIB"
+	ABICOLLAB_TCP_LIBS="-lpthread"
 fi
 CPPFLAGS="$_abi_cppflags_save"
 LDFLAGS="$_abi_ldflags_save"
@@ -193,7 +192,7 @@
 ])
 if test "x$abicollab_handler_service" = "xyes" ; then
 	ABICOLLAB_SERVICE_CPPFLAGS="-DABICOLLAB_HANDLER_SERVICE $ABICOLLAB_ASIO_CPPFLAGS"
-	ABICOLLAB_SERVICE_LIBS="$BOOST_THREAD_LIB"
+	ABICOLLAB_SERVICE_LIBS="-lpthread"
 fi
 AC_SUBST(ABICOLLAB_SERVICE_CPPFLAGS)
 AC_SUBST(ABICOLLAB_SERVICE_LIBS)