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
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
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
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
Max Kellermann
c0775d328c
output/Filtered: move try/catch from IteratePause() to caller
2020-10-01 20:44:11 +02:00
Max Kellermann
362f391b76
Merge remote-tracking branches 'neheb/defa', 'neheb/auto' and 'neheb/clocale' into master
2020-09-30 11:48:05 +02:00
Rosen Penev
980e32f69c
remove clocale test
...
clocale is part of C++11.
In practical terms, gcc's libstdc++ comes with its own locale defines
when the libc does not have them.
Also reworked to be dependent on !ANDROID.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-09-29 14:51:17 -07:00
Rosen Penev
dd639e18b8
clang-tidy: remove pointless std::move
...
Found with performance-move-const-arg
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-09-26 21:34:25 -07:00
Rosen Penev
c883f178b8
clang-tidy: use auto
...
Found with modernize-use-auto
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-09-26 21:33:35 -07:00
Max Kellermann
e9df4116fd
db/upnp: store UPnPDirContent in local variable
...
Fixes use-after-free because the temporary goes out of scope.
2020-09-23 15:25:39 +02:00
Max Kellermann
c843bce9f5
LogLevel: rename DEFAULT to NOTICE
...
"DEFAULT" is a bad name - all it says is that it's the default value,
but it doesn't say what it means. The name NOTICE mimics the syslog
level.
2020-09-23 14:22:33 +02:00
Max Kellermann
e3106a019d
LogInit: provide mappings for LogLevel::{ERROR,WARNING}
2020-09-23 14:17:11 +02:00
Max Kellermann
3e0ceb12d5
LogInit: rename "secure" to "info"
...
Calling this "secure" never made sense. Messages about client
connects are just a small part of what gets logged as "secure",
a.k.a. "info".
2020-09-23 14:15:58 +02:00
Max Kellermann
60bbc9f626
LogInit: use StringIsEqual()
2020-09-23 13:28:19 +02:00
Max Kellermann
065926d6a4
decoder/ffmpeg: support album art
...
Closes https://github.com/MusicPlayerDaemon/MPD/issues/892
2020-09-23 12:50:28 +02:00
Max Kellermann
85bab67083
input/uring: safe cancellation
...
My concept with `class CancellableOperation` doesn't work properly,
because the kernel may continue to write to the given buffer as soon
as the read finishes.
To fix this, this commit adds `class ReadOperation` which owns the
buffer and the `struct iovec`. Instances of this class persist until
the read really finishes, even if the operation is canceled.
2020-09-23 11:07:26 +02:00