From bfe75335465711faae3181c5224119b23cc9d2e0 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 4 Jan 2014 19:29:37 +0100 Subject: output/httpd: move Bind()/Unbind() to the IOThread Fixes more thread-safety bugs. --- src/output/HttpdOutputPlugin.cxx | 12 ++++++++---- 1 file 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 -- cgit v1.2.3