aboutsummaryrefslogtreecommitdiffstats
path: root/src/event/Loop.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/event/Loop.hxx')
-rw-r--r--src/event/Loop.hxx17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/event/Loop.hxx b/src/event/Loop.hxx
index 885e74679..0586a1f68 100644
--- a/src/event/Loop.hxx
+++ b/src/event/Loop.hxx
@@ -42,6 +42,7 @@
#ifdef USE_INTERNAL_EVENTLOOP
class TimeoutMonitor;
class IdleMonitor;
+class DeferredMonitor;
class SocketMonitor;
#endif
@@ -91,6 +92,7 @@ class EventLoop final
Mutex mutex;
std::list<std::function<void()>> calls;
+ std::list<DeferredMonitor *> deferred;
unsigned now_ms;
@@ -162,6 +164,21 @@ public:
void AddCall(std::function<void()> &&f);
/**
+ * Schedule a call to DeferredMonitor::RunDeferred().
+ *
+ * This method is thread-safe.
+ */
+ void AddDeferred(DeferredMonitor &d);
+
+ /**
+ * Cancel a pending call to DeferredMonitor::RunDeferred().
+ * However after returning, the call may still be running.
+ *
+ * This method is thread-safe.
+ */
+ void RemoveDeferred(DeferredMonitor &d);
+
+ /**
* The main function of this class. It will loop until
* Break() gets called. Can be called only once.
*/