diff options
author | Denis Krjuchkov <denis@crazydev.net> | 2013-11-27 17:04:38 +0600 |
---|---|---|
committer | Denis Krjuchkov <denis@crazydev.net> | 2013-11-27 17:28:36 +0600 |
commit | 46bab7e4b921b79924643bacd08dcd3d1404ceb6 (patch) | |
tree | 2fe8e1b2185dba89d953b5d02f22cc0781e17c2c /src/event/Call.cxx | |
parent | 22fb49fa90241abfaf5ac81de462f4b2c274f7d0 (diff) |
Add infrastructure for using multiple event loops
This change adds two configuration options:
--with-eventloop=[glib|internal|auto]
--with-pollmethod=[epoll|auto]
First allows switching between GLib event loop and internal one.
Second chooses backend to use for internal event loop.
Conditional compilation symbols are changed accordingly.
Additional helper macro MPD_OPTIONAL_FUNC_NODEF is added as well.
Diffstat (limited to 'src/event/Call.cxx')
-rw-r--r-- | src/event/Call.cxx | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/event/Call.cxx b/src/event/Call.cxx index ab1d5ffbd..7767824f9 100644 --- a/src/event/Call.cxx +++ b/src/event/Call.cxx @@ -28,7 +28,7 @@ #include <assert.h> class BlockingCallMonitor final -#ifndef USE_EPOLL +#ifdef USE_GLIB_EVENTLOOP : DeferredMonitor #endif { @@ -40,20 +40,22 @@ class BlockingCallMonitor final bool done; public: -#ifdef USE_EPOLL +#ifdef USE_INTERNAL_EVENTLOOP BlockingCallMonitor(EventLoop &loop, std::function<void()> &&_f) :f(std::move(_f)), done(false) { loop.AddCall([this](){ this->DoRun(); }); } -#else +#endif + +#ifdef USE_GLIB_EVENTLOOP BlockingCallMonitor(EventLoop &_loop, std::function<void()> &&_f) :DeferredMonitor(_loop), f(std::move(_f)), done(false) {} #endif void Run() { -#ifndef USE_EPOLL +#ifdef USE_GLIB_EVENTLOOP assert(!done); Schedule(); @@ -65,13 +67,14 @@ public: mutex.unlock(); } -#ifndef USE_EPOLL +#ifdef USE_GLIB_EVENTLOOP private: virtual void RunDeferred() override { DoRun(); } +#endif -#else +#ifdef USE_INTERNAL_EVENTLOOP public: #endif void DoRun() { |