From 21ee9a5ef710250de587ba203f327338d3abbe77 Mon Sep 17 00:00:00 2001 From: pd Date: Sat, 16 Aug 2008 16:09:11 +0200 Subject: [PATCH 1/9] =?UTF-8?q?interface.cpp=20and=20object.cpp=20now=20wi?= =?UTF-8?q?ll=20only=20fill=20the=20interface=20names=20if=20they=20were?= =?UTF-8?q?=20left=20blank=20(Jo=C3=A3o=20Xavier)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/interface.cpp | 8 ++++++-- src/object.cpp | 7 +++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/interface.cpp b/src/interface.cpp index 89a4573..6a47cf6 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -70,7 +70,9 @@ void InterfaceAdaptor::emit_signal(const SignalMessage &sig) { SignalMessage &sig2 = const_cast(sig); - sig2.interface(name().c_str()); + if (sig2.interface() == NULL) + sig2.interface(name().c_str()); + _emit_signal(sig2); } @@ -147,6 +149,8 @@ Message InterfaceProxy::invoke_method(const CallMessage &call) { CallMessage &call2 = const_cast(call); - call2.interface(name().c_str()); + if (call.interface() == NULL) + call2.interface(name().c_str()); + return _invoke_method(call2); } diff --git a/src/object.cpp b/src/object.cpp index 8bf22a8..970fcf7 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -320,8 +320,11 @@ void ObjectProxy::unregister_obj() Message ObjectProxy::_invoke_method(CallMessage &call) { - call.path(path().c_str()); - call.destination(service().c_str()); + if (call.path() == NULL) + call.path(path().c_str()); + + if (call.destination() == NULL) + call.destination(service().c_str()); return conn().send_blocking(call); } From 77f6d3cf8aeaa373453a6f5b00b4c00e46ebc998 Mon Sep 17 00:00:00 2001 From: pd Date: Sat, 16 Aug 2008 16:20:00 +0200 Subject: [PATCH 2/9] =?UTF-8?q?added=20writing=20of=20properties=20in=20xm?= =?UTF-8?q?l2cpp.cpp=20(Jo=C3=A3o=20Xavier)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/xml2cpp.cpp | 56 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/tools/xml2cpp.cpp b/tools/xml2cpp.cpp index 25a32d2..439a419 100644 --- a/tools/xml2cpp.cpp +++ b/tools/xml2cpp.cpp @@ -281,6 +281,62 @@ void generate_proxy(Xml::Document &doc, const char *filename) file << tab << "}" << endl << endl; +/// write properties + file << "public:" << endl << endl + << tab << "/* properties exported by this interface */" << endl; + + for (Xml::Nodes::iterator pi = properties.begin (); + pi != properties.end (); ++pi) + { + Xml::Node & property = **pi; + string prop_name = property.get ("name"); + string property_access = property.get ("access"); + if (property_access == "read" || property_access == "readwrite") + { + file << tab << tab << "const " << signature_to_type (property.get("type")) + << " " << prop_name << "() {" << endl; + file << tab << tab << tab << "::DBus::CallMessage call ;\n "; + file << tab << tab << tab + << "call.member(\"Get\"); call.interface(\"org.freedesktop.DBus.Properties\");" + << endl; + file << tab << tab << tab + << "::DBus::MessageIter wi = call.writer(); " << endl; + file << tab << tab << tab + << "const DBus::String interface_name = \"" << ifacename << "\";" + << endl; + file << tab << tab << tab + << "const DBus::String property_name = \"" << prop_name << "\";" + << endl; + file << tab << tab << tab << "wi << interface_name;" << endl; + file << tab << tab << tab << "wi << property_name;" << endl; + file << tab << tab << tab + << "::DBus::Message ret = this->invoke_method (call);" << endl; + file << tab << tab << tab + << "::DBus::MessageIter ri = ret.reader ();" << endl; + file << tab << tab << tab << "::DBus::Variant argout; " << endl; + file << tab << tab << tab << "ri >> argout;" << endl; + file << tab << tab << tab << "return argout;" << endl; + file << tab << tab << "};" << endl; + } + + if (property_access == "write" || property_access == "readwrite") + { + file << tab << tab << "void " << prop_name << "( const "<< signature_to_type (property.get("type")) << " & input" << ") {" << endl; + file << tab << tab << tab << "::DBus::CallMessage call ;\n "; + file << tab << tab << tab <<"call.member(\"Set\"); call.interface( \"org.freedesktop.DBus.Properties\");"<< endl; + file << tab << tab << tab <<"::DBus::MessageIter wi = call.writer(); " << endl; + file << tab << tab << tab <<"DBus::Variant value;" << endl; + file << tab << tab << tab <<"::DBus::MessageIter vi = value.writer ();" << endl; + file << tab << tab << tab <<"vi << input;" << endl; + file << tab << tab << tab <<"const DBus::String interface_name = \"" << ifacename << "\";" << endl; + file << tab << tab << tab <<"const DBus::String property_name = \"" << prop_name << "\";"<< endl; + file << tab << tab << tab <<"wi << interface_name;" << endl; + file << tab << tab << tab <<"wi << property_name;" << endl; + file << tab << tab << tab <<"wi << value;" << endl; + file << tab << tab << tab <<"::DBus::Message ret = this->invoke_method (call);" << endl; + file << tab << tab << "};" << endl; + } + } file << "public:" << endl << endl From dc4c91a924769c36db30fbd1c5f590ab93dd153f Mon Sep 17 00:00:00 2001 From: pd Date: Sat, 16 Aug 2008 16:21:42 +0200 Subject: [PATCH 3/9] =?UTF-8?q?added=20=5Fproxy=20and=20=5Fadaptor=20sufix?= =?UTF-8?q?es=20to=20generated=20interfaces=20class=20names=20(Jo=C3=A3o?= =?UTF-8?q?=20Xavier)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- configure.ac | 1 + examples/Makefile.am | 2 +- tools/xml2cpp.cpp | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 230564b..7c8e08d 100644 --- a/configure.ac +++ b/configure.ac @@ -185,6 +185,7 @@ AC_OUTPUT( doc/Doxyfile examples/Makefile examples/properties/Makefile + examples/properties_get_set/Makefile examples/echo/Makefile examples/hal/Makefile examples/glib/Makefile diff --git a/examples/Makefile.am b/examples/Makefile.am index b346604..d3cbb7c 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = properties echo hal glib +SUBDIRS = properties properties_get_set echo hal glib MAINTAINERCLEANFILES = \ Makefile.in diff --git a/tools/xml2cpp.cpp b/tools/xml2cpp.cpp index 439a419..4a42c4e 100644 --- a/tools/xml2cpp.cpp +++ b/tools/xml2cpp.cpp @@ -257,6 +257,8 @@ void generate_proxy(Xml::Document &doc, const char *filename) getline(ss, ifaceclass); + ifaceclass += "_proxy"; + cerr << "generating code for interface " << ifacename << "..." << endl; file << "class " << ifaceclass << endl @@ -616,6 +618,8 @@ void generate_adaptor(Xml::Document &doc, const char *filename) getline(ss, ifaceclass); + ifaceclass += "_adaptor"; + cerr << "generating code for interface " << ifacename << "..." << endl; file << "class " << ifaceclass << endl From 52ce50e9440166c9c9c25eb7ba0703ff063a63b3 Mon Sep 17 00:00:00 2001 From: pd Date: Sat, 16 Aug 2008 16:26:28 +0200 Subject: [PATCH 4/9] Typo in xml2cpp.cpp --- tools/xml2cpp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/xml2cpp.cpp b/tools/xml2cpp.cpp index 4a42c4e..bc8dbbf 100644 --- a/tools/xml2cpp.cpp +++ b/tools/xml2cpp.cpp @@ -327,7 +327,7 @@ void generate_proxy(Xml::Document &doc, const char *filename) file << tab << tab << tab << "::DBus::CallMessage call ;\n "; file << tab << tab << tab <<"call.member(\"Set\"); call.interface( \"org.freedesktop.DBus.Properties\");"<< endl; file << tab << tab << tab <<"::DBus::MessageIter wi = call.writer(); " << endl; - file << tab << tab << tab <<"DBus::Variant value;" << endl; + file << tab << tab << tab <<"::DBus::Variant value;" << endl; file << tab << tab << tab <<"::DBus::MessageIter vi = value.writer ();" << endl; file << tab << tab << tab <<"vi << input;" << endl; file << tab << tab << tab <<"const DBus::String interface_name = \"" << ifacename << "\";" << endl; From acc230eb98c48086750d9548bbc938674d31092b Mon Sep 17 00:00:00 2001 From: pd Date: Sat, 16 Aug 2008 16:29:31 +0200 Subject: [PATCH 5/9] =?UTF-8?q?Added=20properties=20proxy=20example=20(Jo?= =?UTF-8?q?=C3=A3o=20Xavier)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/properties_get_set/Makefile.am | 26 +++++++ .../properties_get_set/propsgs-client.cpp | 75 +++++++++++++++++++ examples/properties_get_set/propsgs-client.h | 20 +++++ .../properties_get_set/propsgs-introspect.xml | 11 +++ .../properties_get_set/propsgs-server.cpp | 46 ++++++++++++ examples/properties_get_set/propsgs-server.h | 21 ++++++ 6 files changed, 199 insertions(+) create mode 100644 examples/properties_get_set/Makefile.am create mode 100644 examples/properties_get_set/propsgs-client.cpp create mode 100644 examples/properties_get_set/propsgs-client.h create mode 100644 examples/properties_get_set/propsgs-introspect.xml create mode 100644 examples/properties_get_set/propsgs-server.cpp create mode 100644 examples/properties_get_set/propsgs-server.h diff --git a/examples/properties_get_set/Makefile.am b/examples/properties_get_set/Makefile.am new file mode 100644 index 0000000..6e5419d --- /dev/null +++ b/examples/properties_get_set/Makefile.am @@ -0,0 +1,26 @@ +EXTRA_DIST = propsget-introspect.xml + +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include + +noinst_PROGRAMS = propsgs-server propsgs-client + +propsgs_server_SOURCES = propsgs-glue.h propsgs-server.h propsgs-server.cpp +propsgs_server_LDADD = $(top_builddir)/src/libdbus-c++-1.la + +propsgs_client_SOURCES = propsgs-glue.h propsgs-client.h propsgs-client.cpp +propsgs_client_LDADD = $(top_builddir)/src/libdbus-c++-1.la -lpthread + +propsgs-glue-adaptor.h: propsgs-introspect.xml + $(top_builddir)/tools/dbusxx-xml2cpp $^ --adaptor=$@ -- + +propsgs-glue-proxy.h: propsgs-introspect.xml + $(top_builddir)/tools/dbusxx-xml2cpp $^ --proxy=$@ -- + +BUILT_SOURCES = propsgs-glue-adaptor.h propsgs-glue-proxy.h +CLEANFILES = $(BUILT_SOURCES) + +dist-hook: + cd $(distdir); rm -f $(BUILT_SOURCES) + +MAINTAINERCLEANFILES = \ + Makefile.in diff --git a/examples/properties_get_set/propsgs-client.cpp b/examples/properties_get_set/propsgs-client.cpp new file mode 100644 index 0000000..b47ad39 --- /dev/null +++ b/examples/properties_get_set/propsgs-client.cpp @@ -0,0 +1,75 @@ +#include "propsgs-client.h" +#include +#include + +using namespace org::freedesktop::DBus; + +#define P(x) std::cout << #x << " = " << x << std::endl; + +static const char *PROPS_SERVER_NAME = "org.freedesktop.DBus.Examples.Properties"; +static const char *PROPS_SERVER_PATH = "/org/freedesktop/DBus/Examples/Properties"; + +PropsClient::PropsClient(DBus::Connection &connection, const char *path, const char *name) +: DBus::ObjectProxy(connection, path, name) +{ +} + +void PropsClient::MessageChanged(const std::string& message){ + std::cout << "message received: " << message << std::endl; +}; + +DBus::BusDispatcher dispatcher; + +PropsClient * client; + +void niam(int sig) +{ + dispatcher.leave(); + pthread_exit(NULL); + delete client; +} + +#include + +void * test_property_proxy(void * input){ + P("1"); + sleep(2); + P(client->Version()); + + P("2"); + sleep(1); + P(client->Message()); + + P("3"); + sleep(1); + client->Message( "message set by property access" ); + + P("4"); + sleep(1); + P(client->Message()); + + P("5"); + sleep(1); + client->Data( 1.1 ); +} + +int main() +{ + signal(SIGTERM, niam); + signal(SIGINT, niam); + + DBus::default_dispatcher = &dispatcher; + + DBus::Connection conn = DBus::Connection::SessionBus(); + + client = new PropsClient(conn, PROPS_SERVER_PATH, PROPS_SERVER_NAME ); + + pthread_t thread; + pthread_create(&thread, NULL, test_property_proxy, 0); + + P("dispatcher.enter();"); + + dispatcher.enter(); + + return 0; +} diff --git a/examples/properties_get_set/propsgs-client.h b/examples/properties_get_set/propsgs-client.h new file mode 100644 index 0000000..85595d5 --- /dev/null +++ b/examples/properties_get_set/propsgs-client.h @@ -0,0 +1,20 @@ +#ifndef __DEMO_PROPS_SERVER_H +#define __DEMO_PROPS_SERVER_H + +#include +#include "propsgs-glue-proxy.h" + +class PropsClient +: public org::freedesktop::DBus::PropsGSDemo_proxy, + public DBus::IntrospectableProxy, +// public DBus::PropertiesProxy, + public DBus::ObjectProxy +{ +public: + + PropsClient(DBus::Connection &connection, const char *path, const char *name); + + void MessageChanged(const std::string& message); +}; + +#endif//__DEMO_PROPS_SERVER_H diff --git a/examples/properties_get_set/propsgs-introspect.xml b/examples/properties_get_set/propsgs-introspect.xml new file mode 100644 index 0000000..5c0e74f --- /dev/null +++ b/examples/properties_get_set/propsgs-introspect.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/examples/properties_get_set/propsgs-server.cpp b/examples/properties_get_set/propsgs-server.cpp new file mode 100644 index 0000000..8339d20 --- /dev/null +++ b/examples/properties_get_set/propsgs-server.cpp @@ -0,0 +1,46 @@ +#include "propsgs-server.h" +#include + +static const char *PROPS_SERVER_NAME = "org.freedesktop.DBus.Examples.Properties"; +static const char *PROPS_SERVER_PATH = "/org/freedesktop/DBus/Examples/Properties"; + +PropsServer::PropsServer(DBus::Connection &connection) +: DBus::ObjectAdaptor(connection, PROPS_SERVER_PATH) +{ + Version = 1; + Message = "default message"; +} + +void PropsServer::on_set_property + (DBus::InterfaceAdaptor &interface, const std::string &property, const DBus::Variant &value) +{ + if (property == "Message") + { + std::string msg = value; + this->MessageChanged(msg); + } +} + +DBus::BusDispatcher dispatcher; + +void niam(int sig) +{ + dispatcher.leave(); +} + +int main() +{ + signal(SIGTERM, niam); + signal(SIGINT, niam); + + DBus::default_dispatcher = &dispatcher; + + DBus::Connection conn = DBus::Connection::SessionBus(); + conn.request_name(PROPS_SERVER_NAME); + + PropsServer server(conn); + + dispatcher.enter(); + + return 0; +} diff --git a/examples/properties_get_set/propsgs-server.h b/examples/properties_get_set/propsgs-server.h new file mode 100644 index 0000000..a3169d6 --- /dev/null +++ b/examples/properties_get_set/propsgs-server.h @@ -0,0 +1,21 @@ +#ifndef __DEMO_PROPS_SERVER_H +#define __DEMO_PROPS_SERVER_H + +#include +#include "propsgs-glue-adaptor.h" + +class PropsServer +: public org::freedesktop::DBus::PropsGSDemo_adaptor, + public DBus::IntrospectableAdaptor, + public DBus::PropertiesAdaptor, + public DBus::ObjectAdaptor +{ +public: + + PropsServer(DBus::Connection &connection); + + void on_set_property + (DBus::InterfaceAdaptor &interface, const std::string &property, const DBus::Variant &value); +}; + +#endif//__DEMO_PROPS_SERVER_H From 119579f10679759198db69d8838da7a11228a860 Mon Sep 17 00:00:00 2001 From: pd Date: Sat, 16 Aug 2008 16:33:02 +0200 Subject: [PATCH 6/9] =?UTF-8?q?Make=20examples=20use=20new=20generated=20n?= =?UTF-8?q?ames=20(Jo=C3=A3o=20Xavier)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/echo/echo-client.h | 2 +- examples/echo/echo-server.h | 2 +- examples/properties/props-server.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/echo/echo-client.h b/examples/echo/echo-client.h index abfb620..54401ec 100644 --- a/examples/echo/echo-client.h +++ b/examples/echo/echo-client.h @@ -5,7 +5,7 @@ #include "echo-client-glue.h" class EchoClient -: public org::freedesktop::DBus::EchoDemo, +: public org::freedesktop::DBus::EchoDemo_proxy, public DBus::IntrospectableProxy, public DBus::ObjectProxy { diff --git a/examples/echo/echo-server.h b/examples/echo/echo-server.h index 94d597e..3f0be58 100644 --- a/examples/echo/echo-server.h +++ b/examples/echo/echo-server.h @@ -5,7 +5,7 @@ #include "echo-server-glue.h" class EchoServer -: public org::freedesktop::DBus::EchoDemo, +: public org::freedesktop::DBus::EchoDemo_adaptor, public DBus::IntrospectableAdaptor, public DBus::ObjectAdaptor { diff --git a/examples/properties/props-server.h b/examples/properties/props-server.h index cf9ba83..574ec40 100644 --- a/examples/properties/props-server.h +++ b/examples/properties/props-server.h @@ -5,7 +5,7 @@ #include "props-glue.h" class PropsServer -: public org::freedesktop::DBus::PropsDemo, +: public org::freedesktop::DBus::PropsDemo_adaptor, public DBus::IntrospectableAdaptor, public DBus::PropertiesAdaptor, public DBus::ObjectAdaptor From 085249dfbb9aacc075730803bf266089f3224ff1 Mon Sep 17 00:00:00 2001 From: pd Date: Sat, 16 Aug 2008 16:39:42 +0200 Subject: [PATCH 7/9] Fix previous patches to use standard types --- tools/xml2cpp.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/xml2cpp.cpp b/tools/xml2cpp.cpp index bc8dbbf..45c8dde 100644 --- a/tools/xml2cpp.cpp +++ b/tools/xml2cpp.cpp @@ -304,10 +304,10 @@ void generate_proxy(Xml::Document &doc, const char *filename) file << tab << tab << tab << "::DBus::MessageIter wi = call.writer(); " << endl; file << tab << tab << tab - << "const DBus::String interface_name = \"" << ifacename << "\";" + << "const std::string interface_name = \"" << ifacename << "\";" << endl; file << tab << tab << tab - << "const DBus::String property_name = \"" << prop_name << "\";" + << "const std::string property_name = \"" << prop_name << "\";" << endl; file << tab << tab << tab << "wi << interface_name;" << endl; file << tab << tab << tab << "wi << property_name;" << endl; @@ -330,8 +330,8 @@ void generate_proxy(Xml::Document &doc, const char *filename) file << tab << tab << tab <<"::DBus::Variant value;" << endl; file << tab << tab << tab <<"::DBus::MessageIter vi = value.writer ();" << endl; file << tab << tab << tab <<"vi << input;" << endl; - file << tab << tab << tab <<"const DBus::String interface_name = \"" << ifacename << "\";" << endl; - file << tab << tab << tab <<"const DBus::String property_name = \"" << prop_name << "\";"<< endl; + file << tab << tab << tab <<"const std::string interface_name = \"" << ifacename << "\";" << endl; + file << tab << tab << tab <<"const std::string property_name = \"" << prop_name << "\";"<< endl; file << tab << tab << tab <<"wi << interface_name;" << endl; file << tab << tab << tab <<"wi << property_name;" << endl; file << tab << tab << tab <<"wi << value;" << endl; From 2c864a296cfe0b407d73791ddfe55d827cd18afd Mon Sep 17 00:00:00 2001 From: pd Date: Sat, 16 Aug 2008 16:48:06 +0200 Subject: [PATCH 8/9] Added a pkgconfig file to test a local version without installing it (Andreas Volz) --- configure.ac | 1 + dbus-c++-1-uninstalled.pc.in | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 dbus-c++-1-uninstalled.pc.in diff --git a/configure.ac b/configure.ac index 7c8e08d..334f9dd 100644 --- a/configure.ac +++ b/configure.ac @@ -190,5 +190,6 @@ AC_OUTPUT( examples/hal/Makefile examples/glib/Makefile dbus-c++-1.pc + dbus-c++-1-uninstalled.pc libdbus-c++.spec ) diff --git a/dbus-c++-1-uninstalled.pc.in b/dbus-c++-1-uninstalled.pc.in new file mode 100644 index 0000000..839fa86 --- /dev/null +++ b/dbus-c++-1-uninstalled.pc.in @@ -0,0 +1,13 @@ +prefix= +exec_prefix= +libdir=src +includedir=include + +Name: @PACKAGE@ +Description: Native C++ bindings for D-Bus, Not Installed +Version: @VERSION@ +Requires: +Conflicts: +Libs: ${pcfiledir}/${libdir}/libdbus-c++-1.la +Cflags: -I${pcfiledir}/${includedir} + From 1a95b536de3492f94b4b97a20c7936781dd897e6 Mon Sep 17 00:00:00 2001 From: pd Date: Mon, 18 Aug 2008 23:29:37 +0200 Subject: [PATCH 9/9] Make phtread a non-optional requirement --- configure.ac | 4 +++- examples/echo/Makefile.am | 2 -- include/dbus-c++/eventloop.h | 11 ----------- src/eventloop.cpp | 20 -------------------- 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 #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()