summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Rauwolf <rauwolf@itestra.de>2013-06-06 13:24:16 +0200
committerPhilip Rauwolf <rauwolf@itestra.de>2013-06-06 13:24:16 +0200
commite575bd0f72d30c7dcd0325f13839a91506d6cfbd (patch)
treec8eeffa57895c3cfc6bb1b1818df2189d7f6de2f
parent4ada91c04f494ecbce0f910f0008a94262d845f2 (diff)
downloadgenivi-common-api-dbus-runtime-e575bd0f72d30c7dcd0325f13839a91506d6cfbd.tar.gz
Further fixing the dispatch-issue in DBusConnection
This time for newer compilers that are more strict at differentiating references and copies when starting a thread
-rw-r--r--src/CommonAPI/DBus/DBusConnection.cpp4
-rw-r--r--src/CommonAPI/DBus/DBusConnection.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/CommonAPI/DBus/DBusConnection.cpp b/src/CommonAPI/DBus/DBusConnection.cpp
index 48dfc1c..d198ae8 100644
--- a/src/CommonAPI/DBus/DBusConnection.cpp
+++ b/src/CommonAPI/DBus/DBusConnection.cpp
@@ -29,7 +29,7 @@ DBusObjectPathVTable DBusConnection::libdbusObjectPathVTable_ = {
&DBusConnection::onLibdbusObjectPathMessageThunk
};
-void DBusConnection::dispatch(std::shared_ptr<DBusConnection>& selfReference) {
+void DBusConnection::dispatch(std::shared_ptr<DBusConnection>&& selfReference) {
while (!stopDispatching_ && readWriteDispatch(10) && !selfReference.unique()) {
if(pauseDispatching_) {
dispatchSuspendLock_.lock();
@@ -259,7 +259,7 @@ bool DBusConnection::connect(DBusError& dbusError, bool startDispatchThread) {
initLibdbusSignalFilterAfterConnect();
if(startDispatchThread) {
- dispatchThread_ = new std::thread(&DBusConnection::dispatch, this, this->shared_from_this());
+ dispatchThread_ = new std::thread(&DBusConnection::dispatch, this, std::move(this->shared_from_this()));
}
stopDispatching_ = !startDispatchThread;
diff --git a/src/CommonAPI/DBus/DBusConnection.h b/src/CommonAPI/DBus/DBusConnection.h
index 145d653..8a2c091 100644
--- a/src/CommonAPI/DBus/DBusConnection.h
+++ b/src/CommonAPI/DBus/DBusConnection.h
@@ -115,7 +115,7 @@ class DBusConnection: public DBusProxyConnection, public std::enable_shared_from
bool singleDispatch();
private:
- void dispatch(std::shared_ptr<DBusConnection>& selfReference);
+ void dispatch(std::shared_ptr<DBusConnection>&& selfReference);
void suspendDispatching() const;
void resumeDispatching() const;