From fad59c73675aea115d0c292b5743de2591bdf6b3 Mon Sep 17 00:00:00 2001 From: Juergen Gehring Date: Tue, 28 Feb 2017 03:42:58 -0800 Subject: CommonAPI-D-Bus 3.1.11 --- include/CommonAPI/DBus/CommonAPIDBus.hpp | 2 +- include/CommonAPI/DBus/DBusAddress.hpp | 2 +- include/CommonAPI/DBus/DBusAddressTranslator.hpp | 2 +- include/CommonAPI/DBus/DBusAttribute.hpp | 2 +- include/CommonAPI/DBus/DBusClientId.hpp | 2 +- include/CommonAPI/DBus/DBusConfig.hpp | 2 +- include/CommonAPI/DBus/DBusConnection.hpp | 18 +++++++++++++++--- include/CommonAPI/DBus/DBusDaemonProxy.hpp | 2 +- include/CommonAPI/DBus/DBusDeployment.hpp | 2 +- include/CommonAPI/DBus/DBusError.hpp | 2 +- include/CommonAPI/DBus/DBusErrorEvent.hpp | 2 +- include/CommonAPI/DBus/DBusEvent.hpp | 2 +- include/CommonAPI/DBus/DBusFactory.hpp | 7 ++++++- include/CommonAPI/DBus/DBusFreedesktopAttribute.hpp | 2 +- .../CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp | 2 +- .../DBus/DBusFreedesktopStubAdapterHelper.hpp | 2 +- include/CommonAPI/DBus/DBusFreedesktopVariant.hpp | 4 ++-- include/CommonAPI/DBus/DBusFunctionalHash.hpp | 2 +- include/CommonAPI/DBus/DBusHelper.hpp | 2 +- include/CommonAPI/DBus/DBusInputStream.hpp | 2 +- .../DBusInstanceAvailabilityStatusChangedEvent.hpp | 2 +- include/CommonAPI/DBus/DBusInterfaceHandler.hpp | 2 +- include/CommonAPI/DBus/DBusMainLoop.hpp | 7 ++++--- include/CommonAPI/DBus/DBusMainLoopContext.hpp | 19 ++++++++++--------- include/CommonAPI/DBus/DBusMessage.hpp | 4 ++-- include/CommonAPI/DBus/DBusMultiEvent.hpp | 2 +- include/CommonAPI/DBus/DBusObjectManager.hpp | 2 +- include/CommonAPI/DBus/DBusObjectManagerStub.hpp | 2 +- include/CommonAPI/DBus/DBusOutputStream.hpp | 2 +- include/CommonAPI/DBus/DBusProxy.hpp | 2 +- .../CommonAPI/DBus/DBusProxyAsyncCallbackHandler.hpp | 4 ++-- .../DBusProxyAsyncSignalMemberCallbackHandler.hpp | 8 ++++---- include/CommonAPI/DBus/DBusProxyBase.hpp | 2 +- include/CommonAPI/DBus/DBusProxyConnection.hpp | 2 +- include/CommonAPI/DBus/DBusProxyHelper.hpp | 18 +++++++++--------- include/CommonAPI/DBus/DBusProxyManager.hpp | 2 +- include/CommonAPI/DBus/DBusSelectiveEvent.hpp | 2 +- include/CommonAPI/DBus/DBusSerializableArguments.hpp | 2 +- include/CommonAPI/DBus/DBusServiceRegistry.hpp | 2 +- include/CommonAPI/DBus/DBusStubAdapter.hpp | 2 +- include/CommonAPI/DBus/DBusStubAdapterHelper.hpp | 2 +- include/CommonAPI/DBus/DBusTypeOutputStream.hpp | 2 +- include/CommonAPI/DBus/DBusTypes.hpp | 2 +- include/CommonAPI/DBus/DBusUtils.hpp | 2 +- 44 files changed, 89 insertions(+), 70 deletions(-) (limited to 'include') diff --git a/include/CommonAPI/DBus/CommonAPIDBus.hpp b/include/CommonAPI/DBus/CommonAPIDBus.hpp index 1be7770..3df526d 100644 --- a/include/CommonAPI/DBus/CommonAPIDBus.hpp +++ b/include/CommonAPI/DBus/CommonAPIDBus.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2015-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusAddress.hpp b/include/CommonAPI/DBus/DBusAddress.hpp index 448012c..171a482 100644 --- a/include/CommonAPI/DBus/DBusAddress.hpp +++ b/include/CommonAPI/DBus/DBusAddress.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2015-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusAddressTranslator.hpp b/include/CommonAPI/DBus/DBusAddressTranslator.hpp index b3b0dde..dd5cbef 100644 --- a/include/CommonAPI/DBus/DBusAddressTranslator.hpp +++ b/include/CommonAPI/DBus/DBusAddressTranslator.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusAttribute.hpp b/include/CommonAPI/DBus/DBusAttribute.hpp index 2fd5bd3..5db6b49 100644 --- a/include/CommonAPI/DBus/DBusAttribute.hpp +++ b/include/CommonAPI/DBus/DBusAttribute.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusClientId.hpp b/include/CommonAPI/DBus/DBusClientId.hpp index 982b4dd..f5f5e85 100644 --- a/include/CommonAPI/DBus/DBusClientId.hpp +++ b/include/CommonAPI/DBus/DBusClientId.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusConfig.hpp b/include/CommonAPI/DBus/DBusConfig.hpp index cb07461..3043c8e 100644 --- a/include/CommonAPI/DBus/DBusConfig.hpp +++ b/include/CommonAPI/DBus/DBusConfig.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusConnection.hpp b/include/CommonAPI/DBus/DBusConnection.hpp index 90a6cb6..e88eab6 100644 --- a/include/CommonAPI/DBus/DBusConnection.hpp +++ b/include/CommonAPI/DBus/DBusConnection.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -291,7 +291,7 @@ public: COMMONAPI_EXPORT static void onWakeupMainContext(void* data); - COMMONAPI_EXPORT void enforceAsynchronousTimeouts() const; + COMMONAPI_EXPORT void enforceAsynchronousTimeouts(); COMMONAPI_EXPORT static const DBusObjectPathVTable* getDBusObjectPathVTable(); COMMONAPI_EXPORT void sendPendingSelectiveSubscription(DBusProxy* proxy, @@ -300,6 +300,16 @@ public: uint32_t tag, std::string interfaceMemberSignature); + void notifyDBusSignalHandlers(DBusSignalHandlerPath handlerPath, + const DBusMessage& dbusMessage, + ::DBusHandlerResult& dbusHandlerResult); + + void notifyDBusOMSignalHandlers(const char* dbusSenderName, + const DBusMessage& dbusMessage, + ::DBusHandlerResult& dbusHandlerResult); + + void deleteAsyncHandlers(); + ::DBusConnection* connection_; mutable std::recursive_mutex connectionGuard_; @@ -387,8 +397,10 @@ public: std::set dispatchThreads_; std::condition_variable_any dispatchCondition_; -}; + std::vector asyncHandlersToDelete_; + std::mutex asyncHandlersToDeleteMutex_; +}; template void FunctionQueueEntry::process(std::shared_ptr _connection) { diff --git a/include/CommonAPI/DBus/DBusDaemonProxy.hpp b/include/CommonAPI/DBus/DBusDaemonProxy.hpp index 44b882b..22d461f 100644 --- a/include/CommonAPI/DBus/DBusDaemonProxy.hpp +++ b/include/CommonAPI/DBus/DBusDaemonProxy.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusDeployment.hpp b/include/CommonAPI/DBus/DBusDeployment.hpp index c6ce15c..b12d67c 100644 --- a/include/CommonAPI/DBus/DBusDeployment.hpp +++ b/include/CommonAPI/DBus/DBusDeployment.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusError.hpp b/include/CommonAPI/DBus/DBusError.hpp index bd3a636..25d7864 100644 --- a/include/CommonAPI/DBus/DBusError.hpp +++ b/include/CommonAPI/DBus/DBusError.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusErrorEvent.hpp b/include/CommonAPI/DBus/DBusErrorEvent.hpp index 2256d33..966f9e1 100644 --- a/include/CommonAPI/DBus/DBusErrorEvent.hpp +++ b/include/CommonAPI/DBus/DBusErrorEvent.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusEvent.hpp b/include/CommonAPI/DBus/DBusEvent.hpp index 945988d..4d53d23 100644 --- a/include/CommonAPI/DBus/DBusEvent.hpp +++ b/include/CommonAPI/DBus/DBusEvent.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusFactory.hpp b/include/CommonAPI/DBus/DBusFactory.hpp index 51ec476..157382d 100644 --- a/include/CommonAPI/DBus/DBusFactory.hpp +++ b/include/CommonAPI/DBus/DBusFactory.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -18,6 +18,9 @@ #include namespace CommonAPI { + +class Runtime; + namespace DBus { class DBusAddress; @@ -95,6 +98,8 @@ public: // Initialization COMMONAPI_EXPORT void registerInterface(InterfaceInitFunction _function); + static std::weak_ptr runtime_; + private: COMMONAPI_EXPORT void incrementConnection(std::shared_ptr); COMMONAPI_EXPORT std::shared_ptr getConnection(const ConnectionId_t &); diff --git a/include/CommonAPI/DBus/DBusFreedesktopAttribute.hpp b/include/CommonAPI/DBus/DBusFreedesktopAttribute.hpp index 8f35928..28b41da 100644 --- a/include/CommonAPI/DBus/DBusFreedesktopAttribute.hpp +++ b/include/CommonAPI/DBus/DBusFreedesktopAttribute.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2015-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp b/include/CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp index bc31a89..0a0914d 100644 --- a/include/CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp +++ b/include/CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusFreedesktopStubAdapterHelper.hpp b/include/CommonAPI/DBus/DBusFreedesktopStubAdapterHelper.hpp index d5abcca..42b8f92 100644 --- a/include/CommonAPI/DBus/DBusFreedesktopStubAdapterHelper.hpp +++ b/include/CommonAPI/DBus/DBusFreedesktopStubAdapterHelper.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2015-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusFreedesktopVariant.hpp b/include/CommonAPI/DBus/DBusFreedesktopVariant.hpp index 243604e..bd1fb58 100644 --- a/include/CommonAPI/DBus/DBusFreedesktopVariant.hpp +++ b/include/CommonAPI/DBus/DBusFreedesktopVariant.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -45,7 +45,7 @@ struct ApplyTypeCompareVisitor(nullptr)); } -#ifdef WIN32 +#ifdef _WIN32 if (_visitor.operator()(output.getSignature())) { #else if (_visitor.template operator()(output.getSignature())) { diff --git a/include/CommonAPI/DBus/DBusFunctionalHash.hpp b/include/CommonAPI/DBus/DBusFunctionalHash.hpp index 4903c21..fbc1ea3 100644 --- a/include/CommonAPI/DBus/DBusFunctionalHash.hpp +++ b/include/CommonAPI/DBus/DBusFunctionalHash.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusHelper.hpp b/include/CommonAPI/DBus/DBusHelper.hpp index 889cf53..ebde2b8 100644 --- a/include/CommonAPI/DBus/DBusHelper.hpp +++ b/include/CommonAPI/DBus/DBusHelper.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusInputStream.hpp b/include/CommonAPI/DBus/DBusInputStream.hpp index 61e4133..fab82dd 100644 --- a/include/CommonAPI/DBus/DBusInputStream.hpp +++ b/include/CommonAPI/DBus/DBusInputStream.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.hpp b/include/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.hpp index 9be2e9a..91fa410 100644 --- a/include/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.hpp +++ b/include/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusInterfaceHandler.hpp b/include/CommonAPI/DBus/DBusInterfaceHandler.hpp index fa6c0bb..9804aff 100644 --- a/include/CommonAPI/DBus/DBusInterfaceHandler.hpp +++ b/include/CommonAPI/DBus/DBusInterfaceHandler.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusMainLoop.hpp b/include/CommonAPI/DBus/DBusMainLoop.hpp index b09a8f1..2ca7202 100755 --- a/include/CommonAPI/DBus/DBusMainLoop.hpp +++ b/include/CommonAPI/DBus/DBusMainLoop.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -18,6 +18,7 @@ #include #include #include +#include namespace CommonAPI { namespace DBus { @@ -173,11 +174,11 @@ class DBusMainLoop { DBusMainLoopPollFd wakeFd_; -#ifdef WIN32 +#ifdef _WIN32 DBusMainLoopPollFd sendFd_; #endif - bool hasToStop_; + std::atomic hasToStop_; bool isBroken_; }; diff --git a/include/CommonAPI/DBus/DBusMainLoopContext.hpp b/include/CommonAPI/DBus/DBusMainLoopContext.hpp index 708cfa3..adf132f 100644 --- a/include/CommonAPI/DBus/DBusMainLoopContext.hpp +++ b/include/CommonAPI/DBus/DBusMainLoopContext.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -13,6 +13,7 @@ #include #include #include +#include #include @@ -50,8 +51,6 @@ class DBusQueueDispatchSource: public DispatchSource { private: DBusQueueWatch* watch_; - - std::mutex watchMutex_; }; class DBusWatch: public Watch { @@ -67,7 +66,7 @@ class DBusWatch: public Watch { const pollfd& getAssociatedFileDescriptor(); -#ifdef WIN32 +#ifdef _WIN32 const HANDLE& getAssociatedEvent(); #endif @@ -79,11 +78,12 @@ class DBusWatch: public Watch { ::DBusWatch* libdbusWatch_; pollfd pollFileDescriptor_; std::vector dependentDispatchSources_; + std::mutex dependentDispatchSourcesMutex_; std::weak_ptr mainLoopContext_; std::weak_ptr dbusConnection_; -#ifdef WIN32 +#ifdef _WIN32 HANDLE wsaEvent_; #endif }; @@ -100,7 +100,7 @@ public: const pollfd& getAssociatedFileDescriptor(); -#ifdef WIN32 +#ifdef _WIN32 const HANDLE& getAssociatedEvent(); #endif @@ -129,11 +129,12 @@ private: std::queue> queue_; std::mutex queueMutex_; + std::mutex dependentDispatchSourcesMutex_; std::weak_ptr connection_; const int pipeValue_; -#ifdef WIN32 +#ifdef _WIN32 HANDLE wsaEvent_; #endif @@ -157,7 +158,7 @@ class DBusTimeout: public Timeout { void setPendingCall(DBusPendingCall* _pendingCall); -#ifdef WIN32 +#ifdef _WIN32 __declspec(thread) static DBusTimeout *currentTimeout_; #else thread_local static DBusTimeout *currentTimeout_; @@ -166,7 +167,7 @@ class DBusTimeout: public Timeout { private: void recalculateDueTime(); - int64_t dueTimeInMs_; + std::atomic dueTimeInMs_; ::DBusTimeout* libdbusTimeout_; std::weak_ptr mainLoopContext_; std::weak_ptr dbusConnection_; diff --git a/include/CommonAPI/DBus/DBusMessage.hpp b/include/CommonAPI/DBus/DBusMessage.hpp index ece0b21..98a668d 100644 --- a/include/CommonAPI/DBus/DBusMessage.hpp +++ b/include/CommonAPI/DBus/DBusMessage.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -14,7 +14,7 @@ #include -#ifdef WIN32 +#ifdef _WIN32 #include #endif diff --git a/include/CommonAPI/DBus/DBusMultiEvent.hpp b/include/CommonAPI/DBus/DBusMultiEvent.hpp index db0c1e5..cf18a48 100644 --- a/include/CommonAPI/DBus/DBusMultiEvent.hpp +++ b/include/CommonAPI/DBus/DBusMultiEvent.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusObjectManager.hpp b/include/CommonAPI/DBus/DBusObjectManager.hpp index 2d36aaf..432e733 100644 --- a/include/CommonAPI/DBus/DBusObjectManager.hpp +++ b/include/CommonAPI/DBus/DBusObjectManager.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusObjectManagerStub.hpp b/include/CommonAPI/DBus/DBusObjectManagerStub.hpp index de8495d..d8de02d 100644 --- a/include/CommonAPI/DBus/DBusObjectManagerStub.hpp +++ b/include/CommonAPI/DBus/DBusObjectManagerStub.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusOutputStream.hpp b/include/CommonAPI/DBus/DBusOutputStream.hpp index 6814430..3cd9cb6 100644 --- a/include/CommonAPI/DBus/DBusOutputStream.hpp +++ b/include/CommonAPI/DBus/DBusOutputStream.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusProxy.hpp b/include/CommonAPI/DBus/DBusProxy.hpp index cc9bd06..feedb12 100644 --- a/include/CommonAPI/DBus/DBusProxy.hpp +++ b/include/CommonAPI/DBus/DBusProxy.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.hpp b/include/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.hpp index d21807d..25b2ecd 100644 --- a/include/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.hpp +++ b/include/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -225,7 +225,7 @@ private: } } - //ensure that delegate object (e.g. Proxy) survives + //ensure that delegate object (i.e Proxy) is not destroyed while callback function is invoked if(auto itsDelegateObject = this->delegate_.object_.lock()) this->delegate_.function_(callStatus, std::move(std::get(_argTuple))...); diff --git a/include/CommonAPI/DBus/DBusProxyAsyncSignalMemberCallbackHandler.hpp b/include/CommonAPI/DBus/DBusProxyAsyncSignalMemberCallbackHandler.hpp index 788c1ff..a768e45 100644 --- a/include/CommonAPI/DBus/DBusProxyAsyncSignalMemberCallbackHandler.hpp +++ b/include/CommonAPI/DBus/DBusProxyAsyncSignalMemberCallbackHandler.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2015-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -105,9 +105,9 @@ class DBusProxyAsyncSignalMemberCallbackHandler: public DBusProxyConnection::DBu inline CallStatus handleDBusMessageReply(const CallStatus dbusMessageCallStatus, const DBusMessage& dbusMessage) const { CallStatus callStatus = dbusMessageCallStatus; - //check if object is expired - if(!delegate_.object_.expired()) - delegate_.function_(callStatus, dbusMessage, dbusSignalHandler_, tag_); + //ensure that delegate object (i.e Proxy) is not destroyed while callback function is invoked + if(auto itsDelegateObject = this->delegate_.object_.lock()) + this->delegate_.function_(callStatus, dbusMessage, dbusSignalHandler_, tag_); return callStatus; } diff --git a/include/CommonAPI/DBus/DBusProxyBase.hpp b/include/CommonAPI/DBus/DBusProxyBase.hpp index e0fbaec..5a24de4 100644 --- a/include/CommonAPI/DBus/DBusProxyBase.hpp +++ b/include/CommonAPI/DBus/DBusProxyBase.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusProxyConnection.hpp b/include/CommonAPI/DBus/DBusProxyConnection.hpp index d0db2ba..ec02082 100644 --- a/include/CommonAPI/DBus/DBusProxyConnection.hpp +++ b/include/CommonAPI/DBus/DBusProxyConnection.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusProxyHelper.hpp b/include/CommonAPI/DBus/DBusProxyHelper.hpp index 3f9e175..43655f4 100644 --- a/include/CommonAPI/DBus/DBusProxyHelper.hpp +++ b/include/CommonAPI/DBus/DBusProxyHelper.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -31,7 +31,7 @@ class DBusProxy; template< class, class... > struct DBusProxyHelper; -#ifdef WIN32 +#ifdef _WIN32 // Visual Studio 2013 does not support 'magic statics' yet. // Change back when switched to Visual Studio 2015 or higher. static std::mutex callMethod_mutex_; @@ -51,7 +51,7 @@ struct DBusProxyHelper, const std::string &_signature, const InArgs_&... _in, CommonAPI::CallStatus &_status) { -#ifndef WIN32 +#ifndef _WIN32 static std::mutex callMethod_mutex_; #endif std::lock_guard lock(callMethod_mutex_); @@ -119,7 +119,7 @@ struct DBusProxyHelper, const InArgs_&... _in, CommonAPI::CallStatus &_status, OutArgs_&... _out) { -#ifndef WIN32 +#ifndef _WIN32 static std::mutex callMethodWithReply_mutex_; #endif std::lock_guard lock(callMethodWithReply_mutex_); @@ -160,7 +160,7 @@ struct DBusProxyHelper, const InArgs_&... _in, CommonAPI::CallStatus &_status, OutArgs_&... _out) { -#ifndef WIN32 +#ifndef _WIN32 static std::mutex callMethodWithReply_mutex_; #endif std::lock_guard lock(callMethodWithReply_mutex_); @@ -269,7 +269,7 @@ struct DBusProxyHelper, const InArgs_&... _in, DelegateFunction_ _function, std::tuple _out) { -#ifndef WIN32 +#ifndef _WIN32 static std::mutex callMethodAsync_mutex_; #endif std::lock_guard lock(callMethodAsync_mutex_); @@ -307,7 +307,7 @@ struct DBusProxyHelper, const InArgs_&... _in, DelegateFunction_ _function, std::tuple _out) { -#ifndef WIN32 +#ifndef _WIN32 static std::mutex callMethodAsync_mutex_; #endif std::lock_guard lock(callMethodAsync_mutex_); @@ -384,7 +384,7 @@ struct DBusProxyHelper, CommonAPI::CallStatus &_status, OutArgs_&... _out, const std::tuple &_errorEvents){ -#ifndef WIN32 +#ifndef _WIN32 static std::mutex callMethodWithReply_mutex_; #endif std::lock_guard lock(callMethodWithReply_mutex_); @@ -494,7 +494,7 @@ struct DBusProxyHelper, DelegateFunction_ _function, std::tuple _out, const std::tuple &_errorEvents) { -#ifndef WIN32 +#ifndef _WIN32 static std::mutex callMethodAsync_mutex_; #endif std::lock_guard lock(callMethodAsync_mutex_); diff --git a/include/CommonAPI/DBus/DBusProxyManager.hpp b/include/CommonAPI/DBus/DBusProxyManager.hpp index 1dd8dbe..f8829b4 100644 --- a/include/CommonAPI/DBus/DBusProxyManager.hpp +++ b/include/CommonAPI/DBus/DBusProxyManager.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusSelectiveEvent.hpp b/include/CommonAPI/DBus/DBusSelectiveEvent.hpp index 93bb5ea..075b819 100644 --- a/include/CommonAPI/DBus/DBusSelectiveEvent.hpp +++ b/include/CommonAPI/DBus/DBusSelectiveEvent.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusSerializableArguments.hpp b/include/CommonAPI/DBus/DBusSerializableArguments.hpp index 6b48eff..771de26 100644 --- a/include/CommonAPI/DBus/DBusSerializableArguments.hpp +++ b/include/CommonAPI/DBus/DBusSerializableArguments.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusServiceRegistry.hpp b/include/CommonAPI/DBus/DBusServiceRegistry.hpp index 497e909..3181226 100644 --- a/include/CommonAPI/DBus/DBusServiceRegistry.hpp +++ b/include/CommonAPI/DBus/DBusServiceRegistry.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusStubAdapter.hpp b/include/CommonAPI/DBus/DBusStubAdapter.hpp index 710277b..882ec8f 100644 --- a/include/CommonAPI/DBus/DBusStubAdapter.hpp +++ b/include/CommonAPI/DBus/DBusStubAdapter.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusStubAdapterHelper.hpp b/include/CommonAPI/DBus/DBusStubAdapterHelper.hpp index 3a9b7e8..50ba9ae 100644 --- a/include/CommonAPI/DBus/DBusStubAdapterHelper.hpp +++ b/include/CommonAPI/DBus/DBusStubAdapterHelper.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusTypeOutputStream.hpp b/include/CommonAPI/DBus/DBusTypeOutputStream.hpp index a2e96e5..6cab51f 100644 --- a/include/CommonAPI/DBus/DBusTypeOutputStream.hpp +++ b/include/CommonAPI/DBus/DBusTypeOutputStream.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusTypes.hpp b/include/CommonAPI/DBus/DBusTypes.hpp index 86bed2d..ec7e092 100644 --- a/include/CommonAPI/DBus/DBusTypes.hpp +++ b/include/CommonAPI/DBus/DBusTypes.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/include/CommonAPI/DBus/DBusUtils.hpp b/include/CommonAPI/DBus/DBusUtils.hpp index d12e024..03fd401 100644 --- a/include/CommonAPI/DBus/DBusUtils.hpp +++ b/include/CommonAPI/DBus/DBusUtils.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -- cgit v1.2.1