Commit Graph

26 Commits

Author SHA1 Message Date
Max Kellermann
1aee89f5ea *: include cleanup (using iwyu) 2016-03-01 22:08:13 +01:00
Max Kellermann
1d67aa7bf2 update copyright year to 2016 2016-02-26 17:54:05 +01:00
Max Kellermann
712ed555e6 Copyright year 2015 2015-01-01 19:48:13 +01:00
Max Kellermann
4a28333039 event/Loop: remove the dummy constructor argument 2014-02-05 00:00:03 +01:00
Max Kellermann
4f83c60296 copyright year 2014 2014-01-13 22:31:55 +01:00
Max Kellermann
61b938d6fa event/Loop: allow scheduling events before Run()
Add the debug-only flag "virgin" which gets checked by assert()
calls.  Fixes assertion failures when using zeroconf/avahi.
2014-01-09 17:52:55 +01:00
Max Kellermann
e599b86424 event/Loop: try to avoid the WakeFD when adding DeferredMonitor
Add a flag that indicates whether the EventLoop is currently "busy".
As long as that flag is set, it does not need to be woken up - we can
simply add the DeferredMonitor to the list, and it will be caught by
EventLoop very soon.  This eliminates nearly all of the
DeferredMonitor overhead when compared to IdleMonitor, rendering
IdleMonitor mostly obsolete.
2014-01-05 02:15:34 +01:00
Max Kellermann
e9d764d7ad event/Loop: add attribute "again"
Improved support for added events.
2014-01-05 02:15:01 +01:00
Max Kellermann
6268955778 event/Loop: add thread-safety assertions 2014-01-05 02:14:31 +01:00
Max Kellermann
f685a48008 event/Loop: move code to HandleDeferred() 2014-01-05 01:35:12 +01:00
Max Kellermann
f0d3b47ad8 event/Loop: remove the GLib implementation
Now that the remaining known bugs in poll() implementation are fixed,
we can go on without the GLib implementation.
2014-01-04 19:31:23 +01:00
Max Kellermann
0f9ef2506f event/Loop: remove unused method AddCall() 2014-01-04 16:00:45 +01:00
Max Kellermann
a357d84dce event/DeferredMonitor: make fully thread-safe
Instead of creating a new eventfd for each DeferredMonitor instance,
reuse EventLoop's eventfd, and add a std::list to EventLoop that
manages the list of pending DeferredMonitors.  This std::list is
protected by the same mutex as the "calls" list.

The bottom line is: reduced overhead because the per-instance eventfd
was eliminated, slightly added overhead due to Mutex usage (but
negligible), and we're thread-safe now.

This subsystem is now good enough to replace EventLoop::AddCall().
2014-01-04 15:58:59 +01:00
Max Kellermann
af3f483924 event/Loop: document that AddCall() is thread-safe 2013-12-31 15:31:59 +01:00
Denis Krjuchkov
bb288f0284 event: introduce generic API for internal event loop 2013-11-28 17:06:16 +06:00
Denis Krjuchkov
46bab7e4b9 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.
2013-11-27 17:28:36 +06:00
Max Kellermann
e53a25cbae event: add API documentation 2013-11-24 19:28:04 +01:00
Max Kellermann
154bdf0bca event/SocketMonitor: add method Abandon() 2013-11-06 19:05:45 +01:00
Max Kellermann
be2951b45f gcc.h: rename to Compiler.h 2013-10-15 09:21:59 +02:00
Max Kellermann
c1f4f1fdb6 EventLoop: new implementation using epoll
Implement an event loop without GLib.
2013-08-10 13:54:23 +02:00
Max Kellermann
d23c907a94 thread/Id: new class replacing GThread pointers
Remove a GLib dependencies from class EventLoop and DatabaseLock.
2013-08-10 09:00:04 +02:00
Max Kellermann
9ab0a1f5f1 EventLoop: add methodd IsInside()
Track which thread runs the EventLoop and provide a check whether
we're currently inside.
2013-08-08 23:04:01 +02:00
Max Kellermann
c043b337b1 EventLoop: un-inline Run() and others
Prepare for adding more code.
2013-08-08 23:03:49 +02:00
Max Kellermann
18e429a87e event/Loop: add method WakeUp() 2013-01-30 15:08:09 +01:00
Max Kellermann
d3a479b7fa event/TimeoutMonitor: wrapper for g_timeout_source_new() 2013-01-14 11:12:28 +01:00
Max Kellermann
e83f805b8f Main, IOThread: move GMainLoop setup code to class EventLoop 2013-01-14 09:15:49 +01:00