From 090bc6fa794589afacc8b22f50b6d3aeb39fe0bd Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 8 Aug 2013 21:49:17 +0200 Subject: [PATCH] event/*Monitor: add method GetEventLoop() --- src/event/DeferredMonitor.hxx | 4 ++++ src/event/MultiSocketMonitor.hxx | 5 ++++- src/event/SocketMonitor.hxx | 4 ++++ src/event/TimeoutMonitor.hxx | 4 ++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/event/DeferredMonitor.hxx b/src/event/DeferredMonitor.hxx index abc11b0b3..ffa83359d 100644 --- a/src/event/DeferredMonitor.hxx +++ b/src/event/DeferredMonitor.hxx @@ -44,6 +44,10 @@ public: Cancel(); } + EventLoop &GetEventLoop() { + return loop; + } + void Schedule(); void Cancel(); diff --git a/src/event/MultiSocketMonitor.hxx b/src/event/MultiSocketMonitor.hxx index bf0a221a2..781fdeca6 100644 --- a/src/event/MultiSocketMonitor.hxx +++ b/src/event/MultiSocketMonitor.hxx @@ -63,7 +63,10 @@ public: MultiSocketMonitor(EventLoop &_loop); ~MultiSocketMonitor(); -public: + EventLoop &GetEventLoop() { + return loop; + } + gcc_pure gint64 GetTime() const { return g_source_get_time(&source->base); diff --git a/src/event/SocketMonitor.hxx b/src/event/SocketMonitor.hxx index 1abeb82ca..85866280c 100644 --- a/src/event/SocketMonitor.hxx +++ b/src/event/SocketMonitor.hxx @@ -66,6 +66,10 @@ public: ~SocketMonitor(); + EventLoop &GetEventLoop() { + return loop; + } + bool IsDefined() const { return fd >= 0; } diff --git a/src/event/TimeoutMonitor.hxx b/src/event/TimeoutMonitor.hxx index 4ebc6b644..b0550933e 100644 --- a/src/event/TimeoutMonitor.hxx +++ b/src/event/TimeoutMonitor.hxx @@ -38,6 +38,10 @@ public: Cancel(); } + EventLoop &GetEventLoop() { + return loop; + } + bool IsActive() const { return source != nullptr; }