aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-04 19:29:37 +0100
committerMax Kellermann <max@duempel.org>2014-01-04 19:29:51 +0100
commitbfe75335465711faae3181c5224119b23cc9d2e0 (patch)
tree3fa23a5fac2516074a61c1f4c8ca2a562be88cdf
parent880bf17daee408cd927349b04a0273bd6a37d4cb (diff)
downloadmpd-bfe75335465711faae3181c5224119b23cc9d2e0.tar.gz
mpd-bfe75335465711faae3181c5224119b23cc9d2e0.tar.xz
mpd-bfe75335465711faae3181c5224119b23cc9d2e0.zip
output/httpd: move Bind()/Unbind() to the IOThread
Fixes more thread-safety bugs.
-rw-r--r--src/output/HttpdOutputPlugin.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/output/HttpdOutputPlugin.cxx b/src/output/HttpdOutputPlugin.cxx
index fa6934ff0..d6af03bfb 100644
--- a/src/output/HttpdOutputPlugin.cxx
+++ b/src/output/HttpdOutputPlugin.cxx
@@ -71,8 +71,11 @@ HttpdOutput::Bind(Error &error)
{
open = false;
- const ScopeLock protect(mutex);
- return ServerSocket::Open(error);
+ bool result = false;
+ BlockingCall(DeferredMonitor::GetEventLoop(), [this, &error, &result](){
+ result = ServerSocket::Open(error);
+ });
+ return result;
}
inline void
@@ -80,8 +83,9 @@ HttpdOutput::Unbind()
{
assert(!open);
- const ScopeLock protect(mutex);
- ServerSocket::Close();
+ BlockingCall(DeferredMonitor::GetEventLoop(), [this](){
+ ServerSocket::Close();
+ });
}
inline bool