Little code cleanups and refactorings

This commit is contained in:
Stanislav Angelovic
2018-05-25 20:48:20 +02:00
parent d68be891ee
commit b535198571
6 changed files with 314 additions and 238 deletions
+9 -1
View File
@@ -80,14 +80,22 @@ namespace sdbus { namespace internal {
std::unique_ptr<sdbus::internal::IConnection> clone() const override;
private:
static sd_bus* openBus(Connection::BusType type);
static void finishHandshake(sd_bus* bus);
static int createProcessingExitDescriptor();
static void closeProcessingExitDescriptor(int fd);
static bool processPendingRequest(sd_bus* bus);
static bool waitForNextRequest(sd_bus* bus, int exitFd);
static std::string composeSignalMatchFilter( const std::string& objectPath
, const std::string& interfaceName
, const std::string& signalName );
void notifyProcessingLoopToExit();
void joinWithProcessingLoop();
private:
std::unique_ptr<sd_bus, decltype(&sd_bus_flush_close_unref)> bus_{nullptr, &sd_bus_flush_close_unref};
std::thread asyncLoopThread_;
std::atomic<int> runFd_{-1};
std::atomic<int> exitLoopFd_{-1};
BusType busType_;
static constexpr const uint64_t POLL_TIMEOUT_USEC = 500000;