Max Kellermann
937423dbcf
event/Loop: check the quit
flag after RunDeferred()
...
Allow DeferredEvents to call EventLoop::Break().
2021-09-10 12:14:18 +02:00
Max Kellermann
f5f296b13a
event/TimerWheel: add a "ready" list as a special case
...
This reduces delays of zero-duration timers from up to 1 second to
zero. libavahi-client schedules zero-duration timers often.
2021-03-02 17:14:33 +01:00
Max Kellermann
5a16e3ffa3
event/TimerWheel: optimized container for CoarseTimerEvent
2021-02-05 18:24:25 +01:00
Max Kellermann
1b4fd74575
event/TimerEvent: rename to FineTimerEvent
...
... and make TimerEvent a type alias for FineTimerEvent (i.e. swap
names).
2021-02-05 18:18:05 +01:00
Max Kellermann
e802f1f61a
event/Loop: move TimerSet to separate class
2021-02-05 18:09:21 +01:00
Max Kellermann
271b287356
event/TimerEvent: assign due
in Schedule()
2021-02-05 17:57:05 +01:00
Max Kellermann
906e82f600
event/Loop: fix assertion failure due to wrong "busy" value
...
If an InjectEvent callback schedules a timer, the loop will restart,
but the "busy" flag is still false. The fix is to move the "again"
check before the "busy" setting.
2021-01-12 17:28:42 +01:00
Max Kellermann
13f8a912e3
event/Loop: simplify wake_event initializer
2021-01-11 20:14:20 +01:00
Max Kellermann
cd4b673b6c
event/WakeFD: convert macro to class with a GetSocket() method
2021-01-11 17:02:54 +01:00
Max Kellermann
abbd980671
Merge branch 'v0.22.x'
2021-01-01 19:59:15 +01:00
Max Kellermann
5348f8c9c8
copyright year 2021
2021-01-01 19:54:28 +01:00
Max Kellermann
4e88f95f94
event/Loop: move the "again" check out of the mutex scope
2020-12-01 20:29:21 +01:00
Max Kellermann
790e540c19
event/Loop: use ClockCache
2020-12-01 20:25:42 +01:00
Max Kellermann
8050394003
event/Loop: add noexcept
2020-12-01 20:10:53 +01:00
Max Kellermann
ff8b5bc61b
event/Loop: reorder methods
2020-12-01 20:09:25 +01:00
Max Kellermann
ef8797821f
event/Loop: inline field initializers
2020-12-01 20:07:35 +01:00
Max Kellermann
5f2797e7cc
event/Loop: add more assertions to dtor
2020-12-01 20:05:54 +01:00
Max Kellermann
e286702f4c
event/Loop: rename AddDeferred() to AddDefer()
2020-12-01 17:26:39 +01:00
Max Kellermann
c58aaf545f
event/IdleEvent: make a special case of DeferEvent
2020-12-01 17:14:24 +01:00
Max Kellermann
990f2dc1cf
event/DeferEvent: use class IntrusiveList instead of boost::intrusive::list
2020-12-01 17:14:24 +01:00
Max Kellermann
774b4313f2
event/DeferEvent: split the thread-safe version into new class InjectEvent
2020-12-01 17:14:24 +01:00
Max Kellermann
7c47fe746c
event/Loop: AbandonFD() unlinks the SocketEvent
...
Fixes use-after-free bugs causing assertion failures at shutdown,
because all "abandoned" SocketEvents are still in the linked list.
Closes https://github.com/MusicPlayerDaemon/MPD/issues/986
Closes https://github.com/MusicPlayerDaemon/MPD/issues/987
2020-10-28 15:01:32 +01:00
Max Kellermann
65a1c4a016
event/Loop: pass SocketEvent& to AbandonFD()
2020-10-28 14:59:28 +01:00
Max Kellermann
8348a1ec8f
event/PollGroup: rename to PollBackend
2020-10-19 14:52:59 +02:00
Max Kellermann
a60e782959
event/Loop: reorder assertions
2020-10-18 20:05:22 +02:00
Max Kellermann
8bab5733d7
event/Loop: add assertions
2020-10-18 20:04:16 +02:00
Max Kellermann
a14997ffb8
event/Loop: manage all SocketEvents in a linked list
...
Not only those which are "ready".
2020-10-18 20:01:38 +02:00
Max Kellermann
dd94f97572
event/Loop: un-inline AddFD(), ModifyFD()
...
Prepare for adding more code here.
2020-10-18 19:58:42 +02:00
Max Kellermann
7d502fb448
event/Loop: round epoll_wait() timeout up
...
This implements proper rounding, amending commit dcbb9fe07c
2020-10-18 19:58:42 +02:00
Max Kellermann
f64799622d
event/IdleEvent: use class IntrusiveList<>
2020-10-18 19:28:12 +02:00
Max Kellermann
b611b1824a
event/Loop: move code to Wait()
2020-10-15 20:21:00 +02:00
Max Kellermann
1473d8474f
event/PollGroup: ReadEvents() returns PollResult
2020-10-15 20:15:09 +02:00
Max Kellermann
abf9ae2dd9
event/Loop: rename Abandon() to AbandonFD()
2020-10-14 16:26:06 +02:00
Max Kellermann
5a4055fb08
event/SocketMonitor: refactor to SocketEvent
...
Similar to commits 1686f4e857
and
30a5dd267b
2020-10-14 15:54:12 +02:00
Max Kellermann
4d68a12f03
event/Loop: split the AtScopeExit()
...
Fixes the !HAVE_THREADED_EVENT_LOOP build.
2020-10-14 14:47:59 +02:00
Max Kellermann
0e951da64b
event/Loop: add missing #ifdef
2020-10-14 14:37:29 +02:00
Max Kellermann
38dab040b3
event/Loop: add compile-time option to disable multithreading
...
Not for MPD, but for other applications which might want to copy its
event loop, but do not need multi-threading.
2020-10-14 14:08:38 +02:00
Max Kellermann
1686f4e857
event/IdleMonitor: refactor to IdleEvent
...
Instead of using this as a base class implementing a virtual method,
the new class IdleEvent can be used as a variable, decoupling
IdleMonitor's internal state from the derived class.
This is similar to commit 30a5dd267b
which refactored TimeoutMonitor to TimerEvent.
2020-10-14 13:47:25 +02:00
Max Kellermann
41bc17a27f
event/SocketMonitor: add ready_flags
...
By making each SocketMonitor keep track of its ready flags, this
removes a lot of overhead from EventLoop::RemoveFD().
2020-10-09 17:28:11 +02:00
Max Kellermann
eeb96eb367
event/TimerEvent: add type alias for std::chrono::steady_clock::duration
2020-10-08 20:48:50 +02:00
Max Kellermann
263b0ffdbb
event/TimerEvent: use auto_unlink hook
2020-10-08 20:46:15 +02:00
Max Kellermann
947856ca8e
event/Loop: forward-declare class TimerEvent
2020-10-08 17:24:32 +02:00
Max Kellermann
ca0179b2a9
event/Loop: set the uring_initialized flag
...
Don't attempt to initialize the io_uring subsystem more than once.
2020-10-06 18:58:54 +02:00
Max Kellermann
cdf8ac001c
event/Loop: integrate io_uring support
2020-05-05 17:13:14 +02:00
Max Kellermann
935e622915
event/Loop: allow calling AddFD()... before starting the EventThread
...
Relax the assertions. This is necessary if BlockingCall() is used
before the thread is started.
2020-05-05 17:10:17 +02:00
Rosen Penev
97425d56e7
remove gcc_unused
...
[[maybe_unused]] (introduced in C++17) is standard C++.
https://clang.llvm.org/docs/AttributeReference.html#maybe-unused-unused
says that this is equivalent to the GNU unused attribute.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-16 00:08:21 -07:00
Max Kellermann
2817bf9e95
copyright year 2020
2020-01-18 19:23:49 +01:00
Max Kellermann
803a48e96d
release v0.21.18
...
-----BEGIN PGP SIGNATURE-----
iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAl4CKwwQHG1heEBtdXNp
Y3BkLm9yZwAKCRAjbopYxttFEp46D/9q1pRkhYzCyZPQGX967UPoV+Bc1YMX4o2U
Uh/HqQrKKRAK9goaxu9yMKBIFCbzj6WEZou+/uMEf6ZwXuRcnJMobrUU4+G9Yu3r
FzlQPW870DyOhk2PWHF8CW3oMt/YH05b6nYNo2ocRnX69/oqL1G7ukbF2Pz3TPc0
0uNQYYERdMawNCEi1OarzziR6DKuiN+MtZRgUQVacAsoUirwWGNJuaGSDtc3MMM7
YhgKVmd9XsgVr7fykArj6PLsm2iyXJP5nDB/tIqmwMpQFyhuLUnGOMfhCq02em+r
47LGvmZiSS/9F2JzPU8EL2yzYdBe4QvU6Ol5SfXbom11MZc3Ty502g2jUXVHjCeo
1FljCPHbarTmKhvUc0xQXA9i6exZ0wwtxL+Zv7ZQKquRPAhq8E07qkQpdaTWa6vn
3RfilLE1B/GCgoT6D1+zABxdJ1HRLT7tzFob2kkCccxguK3j2JjCUIkSgM6IY0yv
a6sMEXbqa+Lh8jggs9ksoT6O+T2HHEr3tEfpFHY+t0NFRfwHd9aX9bNjK+Ji0n51
YBf2FCb2EBrMAWNZmEnq+TuKX0HASDtoAXTviRKqBXtEG5V8MdAt4PPICCb+bkDr
psIuYcGeK3vofvq1SwEC7h7gCvsBK5w17/oE2/jYcZLo12H1IdHe5gMP3OUhjel5
BRi6rLlkYw==
=XXXs
-----END PGP SIGNATURE-----
Merge tag 'v0.21.18'
release v0.21.18
2019-12-24 16:31:06 +01:00
Max Kellermann
f1116c9258
event/Loop: remove bogus assertion
...
Can fail if somebody calls Break().
2019-12-23 14:20:09 +01:00
Max Kellermann
dcbb9fe07c
event/Loop: round timeout up to avoid unnecessary wakeups
2019-12-22 11:58:31 +01:00