Commit Graph

15614 Commits

Author SHA1 Message Date
Max Kellermann 7fc04fd5cd event/SocketEvent: move Dispatch() down 2020-10-14 16:21:41 +02:00
Max Kellermann 7901b04c78 event/SocketEvent: allow Cancel() without socket 2020-10-14 16:20:43 +02:00
Max Kellermann 653eea5840 event/SocketEvent: remove unnecessary initializer 2020-10-14 16:18:39 +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 e9f6af61f9 event/Loop: forward-declare class {Idle,Defer}Event 2020-10-14 14:05:17 +02:00
Max Kellermann b06c4e2711 event/{Idle,Defer}Event: use base_hook instead of member_hook
Allows forward declaration.
2020-10-14 14:04:30 +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 9f57732af2 meson.build: increment version to 0.23~git
The new stable branch v0.22.x was forked off and is feature-frozen, so
the "master" branch will become the next major version eventually.
2020-10-14 12:13:12 +02:00
Max Kellermann 329382c1da event/SignalMonitor: add `noexcept` 2020-10-13 17:26:33 +02:00
Max Kellermann fadc03df21 meson.build: move macros to event/Features.h 2020-10-13 16:15:52 +02:00
Max Kellermann 54ee0e28ab event/PollGroup: check _WIN32 instead of USE_WINSELECT 2020-10-13 15:27:58 +02:00
Max Kellermann 92fc53ebef event/PollGroupWinSelect: use range-based `for` 2020-10-12 12:44:23 +02:00
Max Kellermann 7e7a1613cf event/PollGroupWinSelect: use std::copy_n() 2020-10-12 12:40:32 +02:00
Max Kellermann f73c4643ef event/PollGroupWinSelect: move IsEmpty() check to GetPtr() 2020-10-12 12:39:10 +02:00
Max Kellermann 8b94e8f260 event/PollGroupWinSelect: use `SOCKET` instead of `int` 2020-10-12 12:13:46 +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 41c0bbab13 event/SocketMonitor: don't filter out ERROR/HANGUP
By bit-wise ANDing the reported flags with GetScheduledFlags(),
ERROR/HANGUP always get cleared.  This means the MPD event loop could
never report those conditions.
2020-10-08 21:16:18 +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 ce93e58944 event/TimerEvent: use `using` instead of `typedef` 2020-10-08 20:46:18 +02:00
Max Kellermann 263b0ffdbb event/TimerEvent: use auto_unlink hook 2020-10-08 20:46:15 +02:00
Max Kellermann 22bea5c97e event/Loop: reorder includes
This just happened to break the Windows build because of the
`GetObject` macro in `windows.h`, so I added a kludge to
PollResultGeneric.hxx.
2020-10-08 20:43:21 +02:00
Max Kellermann 75802ebcc6 StateFileConfig, ...: drop obsolete out-of-class definition 2020-10-08 20:38:11 +02:00
Max Kellermann 27cc7b352d config/Data: cast to std::chrono::steady_clock::duration properly
Oh no, 3413d1bf23 was broken!  Instead of passing a number as
"seconds" to the duration constructor, it just abused the duration
constructor as cast operator, which caused custom state_file_interval
settings to be extremely short.
2020-10-08 20:30:33 +02:00
Max Kellermann d64729065e config/Parser: use std::size_t 2020-10-08 20:26:39 +02:00
Max Kellermann ab318200db config/{Data,Block}: use With() in GetUnsigned(), GetPositive() 2020-10-08 20:21:09 +02:00
Max Kellermann 947856ca8e event/Loop: forward-declare class TimerEvent 2020-10-08 17:24:32 +02:00
Max Kellermann cd9ff9d9b0 event/TimerEvent: use base_hook instead of member_hook 2020-10-08 17:00:09 +02:00
Max Kellermann 4cd0f661d6 event/Loop: use `using` instead of `typedef` 2020-10-08 16:59:21 +02:00
Max Kellermann bf270a5663 doc/user.rst: document io_uring 2020-10-06 19:14:44 +02:00
Max Kellermann 6e893f40e3 doc/user.rst: common startup problems 2020-10-06 19:14:18 +02:00
Max Kellermann 7690905503 doc/user.rst: remove "Question" prefix from "Common Problems" 2020-10-06 19:03:03 +02:00
Max Kellermann 6f822a6f19 doc/user.rst: remove numbers from section headers 2020-10-06 18:59:01 +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 6682cf749f playlist/cue/parser: use lambda to fix ambiguous overload
On Windows, there is an IsWhitespaceOrNull() overload with TCHAR, and
the compiler doesn't know which one to pass to std::find_if().
2020-10-05 21:15:10 +02:00
Max Kellermann 492607ecbe playlist/cue/parser: use StringView internally
Don't copy the input StringView.
2020-10-05 21:04:49 +02:00
Max Kellermann e0c75da266 playlist/cue/parser: pass StringView to Feed() 2020-10-05 20:33:58 +02:00
Max Kellermann 34bb53a29f playlist/cue/parser: add `noexcept` 2020-10-05 20:33:50 +02:00
Max Kellermann cb4fdac469 playlist/cue/parser: fix nullptr dereference
Closes https://github.com/MusicPlayerDaemon/MPD/issues/974
2020-10-05 20:26:42 +02:00
Max Kellermann ac46a84391 playlist/cue/parser: fix off-by-one buffer overflow
cue_next_word() can return a pointer one past the end of the string if
the word is followed by the terminating null byte.
2020-10-05 20:26:02 +02:00
Max Kellermann dffd5831f8 test/fuzzer: a simple fuzzer using libFuzzer
This commit adds some basic infrastructure for fuzzers, and adds a
fuzzer for the CUE sheet parser.
2020-10-05 20:25:26 +02:00
Max Kellermann 8358b34efa meson_options.txt: move "test" to a new section 2020-10-05 19:44:52 +02:00
Max Kellermann 4484d7a5c2 output/jack: implement Interrupt() 2020-10-02 11:00:04 +02:00
Max Kellermann b80a135cf3 output/pulse: implement Interrupt() 2020-10-02 10:52:25 +02:00
Max Kellermann 4ad525d939 output/alsa: implement Interrupt()
This allows canceling the blocking method LockWaitWriteAvailable(),
and thus allows breaking free of misbehaving ALSA drivers, avoiding a
MPD lockup.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/966
2020-10-02 10:35:18 +02:00
Max Kellermann 4cb5e69811 output/Interface: add virtual method Interrupt()
This allows interrupting the output thread (for some plugins which
implement this method).  This way, operations can be canceled
properly, instead of waiting for some external entity.
2020-10-02 10:20:39 +02:00
Max Kellermann b0596291a8 output/Thread: simplify the main loop switch
Move the InternalPlay() call and the wake_cond.wait() call into the
`case Command::NONE` and revert all `continue` statements to a simple
`break`.
2020-10-02 10:10:53 +02:00
Max Kellermann 8f0a1a5d82 output/Interface: add `noexcept` 2020-10-01 20:44:14 +02:00