summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpd <shackan@aris-ubuntu804.(none)>2008-08-18 23:29:37 +0200
committerpd <shackan@aris-ubuntu804.(none)>2008-08-18 23:29:37 +0200
commit1a95b536de3492f94b4b97a20c7936781dd897e6 (patch)
treea045ed5b2743537b463616c6f986e5592e0d1722
parent2c864a296cfe0b407d73791ddfe55d827cd18afd (diff)
downloaddbus-c++-1a95b536de3492f94b4b97a20c7936781dd897e6.tar.gz
Make phtread a non-optional requirement
-rw-r--r--configure.ac4
-rw-r--r--examples/echo/Makefile.am2
-rw-r--r--include/dbus-c++/eventloop.h11
-rw-r--r--src/eventloop.cpp20
4 files changed, 3 insertions, 34 deletions
diff --git a/configure.ac b/configure.ac
index 334f9dd..0e5ed6b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -124,7 +124,9 @@ AC_CHECK_LIB([pthread], pthread_create,
[AC_CHECK_HEADERS(pthread.h, have_pthread=true, have_pthread=false)],
have_pthread=false)
-AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = "true")
+if test "$have_pthread" = "false"; then
+ AC_MSG_ERROR([You need the POSIX Thread library (pthreads)])
+fi
if test "$enable_debug" = "yes" ; then
CXXFLAGS="$CXXFLAGS -Wall -ggdb -O0 -DDEBUG"
diff --git a/examples/echo/Makefile.am b/examples/echo/Makefile.am
index 1ba7065..565fb1a 100644
--- a/examples/echo/Makefile.am
+++ b/examples/echo/Makefile.am
@@ -10,9 +10,7 @@ echo_server_LDADD = $(top_builddir)/src/libdbus-c++-1.la
echo-server-glue.h: echo-introspect.xml
$(top_builddir)/tools/dbusxx-xml2cpp $^ --adaptor=$@
-if HAVE_PTHREAD
noinst_PROGRAMS += echo-client-mt
-endif
echo_client_mt_SOURCES = echo-client-glue.h echo-client.h echo-client.cpp
echo_client_mt_LDADD = $(top_builddir)/src/libdbus-c++-1.la -lpthread
diff --git a/include/dbus-c++/eventloop.h b/include/dbus-c++/eventloop.h
index f2a4cae..42d66b1 100644
--- a/include/dbus-c++/eventloop.h
+++ b/include/dbus-c++/eventloop.h
@@ -29,10 +29,7 @@
#include <dbus-c++/config.h>
#endif
-#ifdef HAVE_PTHREAD_H
#include <pthread.h>
-#endif
-
#include <list>
#include "api.h"
@@ -143,15 +140,7 @@ public:
private:
-#if defined HAVE_PTHREAD_H
-
pthread_mutex_t _mutex;
-
-#elif defined HAVE_WIN32
-
-//TODO: use a critical section
-
-#endif
};
class DXXAPI DefaultMainLoop
diff --git a/src/eventloop.cpp b/src/eventloop.cpp
index c6f95ef..1d4aa2a 100644
--- a/src/eventloop.cpp
+++ b/src/eventloop.cpp
@@ -74,42 +74,22 @@ DefaultWatch::~DefaultWatch()
DefaultMutex::DefaultMutex()
{
-#if defined HAVE_PTHREAD_H
-
pthread_mutex_init(&_mutex, NULL);
-
-#elif defined HAVE_WIN32
-#endif
}
DefaultMutex::~DefaultMutex()
{
-#if defined HAVE_PTHREAD_H
-
pthread_mutex_destroy(&_mutex);
-
-#elif defined HAVE_WIN32
-#endif
}
void DefaultMutex::lock()
{
-#if defined HAVE_PTHREAD_H
-
pthread_mutex_lock(&_mutex);
-
-#elif defined HAVE_WIN32
-#endif
}
void DefaultMutex::unlock()
{
-#if defined HAVE_PTHREAD_H
-
pthread_mutex_unlock(&_mutex);
-
-#elif defined HAVE_WIN32
-#endif
}
DefaultMainLoop::DefaultMainLoop()