Max Kellermann
9a909d9f27
Instance: un-inline the constructor
2017-02-17 23:22:05 +01:00
Max Kellermann
90d25a40a0
Instance: use C++11 initializer
2017-02-17 23:21:55 +01:00
Max Kellermann
c335f18be7
Partition: add "name" attribute
2017-02-17 23:18:51 +01:00
Max Kellermann
7dc3e73782
command: add command "listpartitions"
...
The first step to multi-player support. Not much, just a dummy
command.
2017-02-17 23:07:31 +01:00
Max Kellermann
47dffe66aa
output/alsa: fix race condition on early snd_pcm_writei() error
...
During UnlockActivate() while the mutex is unlocked, the IOThread can
set a new error condition, and will never again wake up the
OutputThread. This race condition can cause a deadlock in the
OutputThread.
2017-02-15 11:23:44 +01:00
Max Kellermann
6636c69a11
storage/FileInfo: convert mtime to std::chrono::system_clock::time_point
2017-02-11 23:45:15 +01:00
Max Kellermann
0ccaf4a1ff
storage/FileInfo: add initializing constructor
2017-02-11 23:45:14 +01:00
Max Kellermann
5cdbad7937
db/simple/Directory: make parent and path const
2017-02-11 23:45:14 +01:00
Max Kellermann
fc0508c047
db/simple/Directory: use C++11 initializers
2017-02-11 23:45:14 +01:00
Max Kellermann
78ca5491e6
db/Interface: GetUpdateStamp() returns std::chrono::system_clock::time_point
2017-02-11 23:02:17 +01:00
Max Kellermann
4146475c73
util/ChronoUtil: new utility library for std::chrono
2017-02-11 22:23:33 +01:00
Max Kellermann
329c3ab21b
fs/FileInfo: use std::chrono::system_clock
2017-02-10 23:48:21 +01:00
Max Kellermann
3b7f6641d2
TimePrint: std::chrono::system_clock support
2017-02-10 23:48:21 +01:00
Max Kellermann
781487c4dd
thread/Thread: use BoundMethod
2017-02-10 22:46:09 +01:00
Max Kellermann
5ba5bc8ba1
thread/Thread: move code to Run()
2017-02-10 22:43:55 +01:00
Max Kellermann
82c66ce078
thread/Thread: Start() returns void
...
Since we switched to C++ exceptions, there is no code path which
returns false.
2017-02-10 22:41:29 +01:00
Max Kellermann
9324fbf921
event/Thread: remove the Mutex
...
We don't need to access Thread::handle early inside the EventThread,
so we don't need this trick anymore.
2017-02-10 22:29:31 +01:00
Max Kellermann
5e081de14a
IOThread: move EventThread instance into struct Instance
...
Eliminate global variables.
2017-02-10 22:25:06 +01:00
Max Kellermann
d1456ae039
test/*: use class EventThread instead of ScopeIOThread
2017-02-10 22:25:01 +01:00
Max Kellermann
115af4f565
event/Loop: Break() is no-op if "quit" is already set
2017-02-10 22:24:48 +01:00
Max Kellermann
822724d1aa
event/Thread: auto-stop in the destructor
2017-02-10 22:24:46 +01:00
Max Kellermann
87c9856b20
input/alsa: use the EventLoop& passed to init() instead of io_thread_get()
2017-02-10 22:24:44 +01:00
Max Kellermann
835136dcd3
output/Thread: add assertion on the ao_plugin_play() result
2017-02-10 22:24:36 +01:00
Max Kellermann
4a80e9cb25
output/alsa: copy the PcmExport result to the ring_buffer
...
.. and not the input data.
Regression from commit b1c7649edb
(integer underflow).
https://bugs.musicpd.org/view.php?id=4639
2017-02-10 22:23:00 +01:00
Max Kellermann
de80c270bd
IOThread: move code to class EventThread
2017-02-10 21:40:39 +01:00
Max Kellermann
b92bff2658
IOThread: remove unused function io_thread_inside()
2017-02-10 21:40:30 +01:00
Max Kellermann
42f1e26540
IOThread: remove unused Cond variable
2017-02-10 21:29:54 +01:00
Max Kellermann
cfd056231b
output/alsa: use the EventLoop& parameter instead of io_thread_get()
2017-02-10 21:21:15 +01:00
Max Kellermann
b1c7649edb
output/alsa: non-blocking mode
...
Use SND_PCM_NONBLOCK, and perform all snd_pcm_writei() calls in the
IOThread. Use a lockless queue to copy data from the OutputThread to
the IOThread.
This rather major change aims to improve MPD's internal latency. All
waits are now under MPD's control, instead of blocking inside
libasound2.
As a side effect, an output's filter is now decoupled from the actual
device I/O, which solves a major latency problem with the conversion
filter on slow CPUs and small period buffers. See:
https://bugs.musicpd.org/view.php?id=3900
2017-02-09 21:36:18 +01:00
Max Kellermann
853740f1e2
Main: use the IOThread for outputs and mixers
...
The main EventLoop can block for a long time while a client's command
runs, and is therefore inappropriate for internal engine I/O. This
fixes a serious regression for at least the "httpd" output, which used
to be hard-coded for the IOThread, but now receives the main EventLoop
as an initialization parameter.
For the mixers, this doesn't make much of a difference. They are not
latency critical.
2017-02-09 21:33:49 +01:00
Max Kellermann
14986b153a
event/Loop: use std::lock_guard
2017-02-09 21:26:55 +01:00
Max Kellermann
9e503b21c1
{input,mixer}/alsa: move code to lib/alsa/NonBlock.cxx
2017-02-09 21:24:24 +01:00
Max Kellermann
67a958a326
Merge branch 'v0.20.x'
2017-02-09 21:24:20 +01:00
Max Kellermann
7372c931b3
event/Loop: make IsInsideOrNull() available in the NDEBUG build
...
Fixes build breakage by commit 4e5271fcdf7; and this method does make
sense in non-debug builds.
2017-02-09 21:21:49 +01:00
Max Kellermann
29e1b6e465
mixer/alsa: reset the MultiSocketMonitor in the destructor
...
Fixes potential crash bug.
2017-02-09 21:13:19 +01:00
Max Kellermann
eda06993f8
event/MultiSocketMonitor: add method Reset()
2017-02-09 21:12:23 +01:00
Max Kellermann
4b30ef1cf2
event/MultiSocketMonitor: use C++11 initializer
2017-02-09 21:12:23 +01:00
Max Kellermann
e92e5e8eb8
event/MultiSocketMonitor: more API documentation
...
Now ClearSocketList() may only be called from PrepareSockets().
Calling it before destroying the object doesn't work properly, because
it doesn't unregister the TimeoutMonitor and the IdleMonitor. Some of
its callers need to be fixed.
2017-02-09 21:12:23 +01:00
Max Kellermann
4e5271fcdf
event/Call: allow usage during shutdown
...
Change EventLoop::IsInside() call to EventLoop::IsInsideOrNull().
This means that BlockingCall() may be used during shutdown, after the
main EventLoop::Run() has finished. This is important because mixers
are currently registered in the main EventLoop.
2017-02-09 21:12:23 +01:00
Max Kellermann
3c55487a16
configure.ac: don't require libsidutils when building with libsidplayfp
...
The libsidplayfp fork has merged libsidutils into the main library.
The libsidutils we used to link with was part of the original
libsidplay project.
2017-02-09 13:09:03 +01:00
Max Kellermann
76a1cae5d8
{input,mixer}/alsa: fix off-by-one bug in count check
...
Doesn't make a practical difference - but it's more correct this way.
2017-02-09 12:46:49 +01:00
Max Kellermann
3850716522
command/Database: add "sort" parameter to "find" and "search"
...
Implement the second part of https://bugs.musicpd.org/view.php?id=3990
2017-02-08 11:22:08 +01:00
Max Kellermann
1e0a60e73d
doc/protocol: remove UTF-8 explanation
...
These days, this is common knowledge, and doesn't need a lengthy
explanation.
2017-02-08 11:22:08 +01:00
Max Kellermann
e9c99e0518
DetachedSong: add LightSong cast operator
2017-02-08 10:38:25 +01:00
Max Kellermann
332baa4f67
DetachedSong: don't declare empty destructor
...
An explicit destructor prevents usage of implicit move operators, even
if it's empty. Therefore, declaring a defaulted destructor with GCC
attribute "noinline" does what we want without preventing those
implicit operators.
2017-02-08 10:24:45 +01:00
Max Kellermann
08879d2a20
DetachedSong: add move operator
2017-02-08 10:24:40 +01:00
Max Kellermann
1292af4768
Revert "DetachedSong: remove explicitly-defaulted copy/move constructors"
...
This reverts commit 67b7d46432
.
Turns out I was wrong, and mentioning these does make a difference:
the implicit move constructor is not defined in the presence of a
user-declared destructor.
2017-02-08 10:21:35 +01:00
Max Kellermann
4d88a099f9
Compiler.h: add gcc_noinline
2017-02-08 10:17:21 +01:00
Max Kellermann
777e15bd78
db/DatabaseSong: make the Storage optional
...
Some database plugins don't use a Storage (e.g. UPnP), and with this
plugin, DatabaseDetachSong() can crash.
2017-02-08 10:05:55 +01:00
Max Kellermann
f689e28958
SongLoader: return instance, not pointer
2017-02-08 10:02:08 +01:00