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 #endif -#ifdef HAVE_PTHREAD_H #include -#endif - #include #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()