Make phtread a non-optional requirement

This commit is contained in:
pd 2008-08-18 23:29:37 +02:00
parent 2c864a296c
commit 1a95b536de
4 changed files with 3 additions and 34 deletions

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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()