summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/IOThread.cxx7
-rw-r--r--src/db/update/Service.cxx6
-rw-r--r--src/decoder/DecoderThread.cxx6
-rw-r--r--src/input/ThreadInputStream.cxx10
-rw-r--r--src/input/ThreadInputStream.hxx4
-rw-r--r--src/input/plugins/MmsInputPlugin.cxx9
-rw-r--r--src/neighbor/plugins/SmbclientNeighborPlugin.cxx5
-rw-r--r--src/output/OutputThread.cxx5
-rw-r--r--src/player/Thread.cxx5
-rw-r--r--src/thread/Thread.cxx13
-rw-r--r--src/thread/Thread.hxx4
11 files changed, 21 insertions, 53 deletions
diff --git a/src/IOThread.cxx b/src/IOThread.cxx
index b0079083d..4fbe837f7 100644
--- a/src/IOThread.cxx
+++ b/src/IOThread.cxx
@@ -24,8 +24,6 @@
#include "thread/Thread.hxx"
#include "thread/Name.hxx"
#include "event/Loop.hxx"
-#include "system/FatalError.hxx"
-#include "util/Error.hxx"
#include <assert.h>
@@ -75,10 +73,7 @@ io_thread_start()
assert(!io.thread.IsDefined());
const ScopeLock protect(io.mutex);
-
- Error error;
- if (!io.thread.Start(io_thread_func, nullptr, error))
- FatalError(error);
+ io.thread.Start(io_thread_func, nullptr);
}
void
diff --git a/src/db/update/Service.cxx b/src/db/update/Service.cxx
index 85732dadd..ce3696850 100644
--- a/src/db/update/Service.cxx
+++ b/src/db/update/Service.cxx
@@ -27,9 +27,7 @@
#include "db/plugins/simple/Directory.hxx"
#include "storage/CompositeStorage.hxx"
#include "Idle.hxx"
-#include "util/Error.hxx"
#include "Log.hxx"
-#include "system/FatalError.hxx"
#include "thread/Thread.hxx"
#include "thread/Util.hxx"
@@ -160,9 +158,7 @@ UpdateService::StartThread(UpdateQueueItem &&i)
next = std::move(i);
walk = new UpdateWalk(GetEventLoop(), listener, *next.storage);
- Error error;
- if (!update_thread.Start(Task, this, error))
- FatalError(error);
+ update_thread.Start(Task, this);
FormatDebug(update_domain,
"spawned thread for update job id %i", next.id);
diff --git a/src/decoder/DecoderThread.cxx b/src/decoder/DecoderThread.cxx
index e393ae8d6..49b5fd1c4 100644
--- a/src/decoder/DecoderThread.cxx
+++ b/src/decoder/DecoderThread.cxx
@@ -24,7 +24,6 @@
#include "DecoderError.hxx"
#include "DecoderPlugin.hxx"
#include "DetachedSong.hxx"
-#include "system/FatalError.hxx"
#include "MusicPipe.hxx"
#include "fs/Traits.hxx"
#include "fs/AllocatedPath.hxx"
@@ -520,8 +519,5 @@ decoder_thread_start(DecoderControl &dc)
assert(!dc.thread.IsDefined());
dc.quit = false;
-
- Error error;
- if (!dc.thread.Start(decoder_task, &dc, error))
- FatalError(error);
+ dc.thread.Start(decoder_task, &dc);
}
diff --git a/src/input/ThreadInputStream.cxx b/src/input/ThreadInputStream.cxx
index 1bb11057a..f70abea36 100644
--- a/src/input/ThreadInputStream.cxx
+++ b/src/input/ThreadInputStream.cxx
@@ -44,8 +44,8 @@ ThreadInputStream::~ThreadInputStream()
}
}
-InputStream *
-ThreadInputStream::Start(Error &error)
+void
+ThreadInputStream::Start()
{
assert(buffer == nullptr);
@@ -53,11 +53,7 @@ ThreadInputStream::Start(Error &error)
assert(p != nullptr);
buffer = new CircularBuffer<uint8_t>((uint8_t *)p, buffer_size);
-
- if (!thread.Start(ThreadFunc, this, error))
- return nullptr;
-
- return this;
+ thread.Start(ThreadFunc, this);
}
inline void
diff --git a/src/input/ThreadInputStream.hxx b/src/input/ThreadInputStream.hxx
index 3756b7c56..6ad45545c 100644
--- a/src/input/ThreadInputStream.hxx
+++ b/src/input/ThreadInputStream.hxx
@@ -78,10 +78,8 @@ public:
/**
* Initialize the object and start the thread.
- *
- * @return false on error
*/
- InputStream *Start(Error &error);
+ void Start();
/* virtual methods from InputStream */
bool Check(Error &error) override final;
diff --git a/src/input/plugins/MmsInputPlugin.cxx b/src/input/plugins/MmsInputPlugin.cxx
index 8f16283f8..25af267e1 100644
--- a/src/input/plugins/MmsInputPlugin.cxx
+++ b/src/input/plugins/MmsInputPlugin.cxx
@@ -73,7 +73,7 @@ MmsInputStream::Open(Error &error)
static InputStream *
input_mms_open(const char *url,
Mutex &mutex, Cond &cond,
- Error &error)
+ gcc_unused Error &error)
{
if (!StringStartsWith(url, "mms://") &&
!StringStartsWith(url, "mmsh://") &&
@@ -82,11 +82,8 @@ input_mms_open(const char *url,
return nullptr;
auto m = new MmsInputStream(url, mutex, cond);
- auto is = m->Start(error);
- if (is == nullptr)
- delete m;
-
- return is;
+ m->Start();
+ return m;
}
size_t
diff --git a/src/neighbor/plugins/SmbclientNeighborPlugin.cxx b/src/neighbor/plugins/SmbclientNeighborPlugin.cxx
index d43d5eb64..ea0528d35 100644
--- a/src/neighbor/plugins/SmbclientNeighborPlugin.cxx
+++ b/src/neighbor/plugins/SmbclientNeighborPlugin.cxx
@@ -83,10 +83,11 @@ private:
};
bool
-SmbclientNeighborExplorer::Open(Error &error)
+SmbclientNeighborExplorer::Open(gcc_unused Error &error)
{
quit = false;
- return thread.Start(ThreadFunc, this, error);
+ thread.Start(ThreadFunc, this);
+ return true;
}
void
diff --git a/src/output/OutputThread.cxx b/src/output/OutputThread.cxx
index 3cc62a36c..4b2f336e8 100644
--- a/src/output/OutputThread.cxx
+++ b/src/output/OutputThread.cxx
@@ -33,7 +33,6 @@
#include "thread/Util.hxx"
#include "thread/Slack.hxx"
#include "thread/Name.hxx"
-#include "system/FatalError.hxx"
#include "util/Error.hxx"
#include "util/ConstBuffer.hxx"
#include "Log.hxx"
@@ -709,7 +708,5 @@ AudioOutput::StartThread()
{
assert(command == Command::NONE);
- Error error;
- if (!thread.Start(Task, this, error))
- FatalError(error);
+ thread.Start(Task, this);
}
diff --git a/src/player/Thread.cxx b/src/player/Thread.cxx
index 5631a97e2..836075e01 100644
--- a/src/player/Thread.cxx
+++ b/src/player/Thread.cxx
@@ -26,7 +26,6 @@
#include "MusicBuffer.hxx"
#include "MusicChunk.hxx"
#include "DetachedSong.hxx"
-#include "system/FatalError.hxx"
#include "CrossFade.hxx"
#include "Control.hxx"
#include "output/MultipleOutputs.hxx"
@@ -1235,7 +1234,5 @@ StartPlayerThread(PlayerControl &pc)
{
assert(!pc.thread.IsDefined());
- Error error;
- if (!pc.thread.Start(player_task, &pc, error))
- FatalError(error);
+ pc.thread.Start(player_task, &pc);
}
diff --git a/src/thread/Thread.cxx b/src/thread/Thread.cxx
index 67697a7be..b81958bec 100644
--- a/src/thread/Thread.cxx
+++ b/src/thread/Thread.cxx
@@ -19,14 +19,14 @@
#include "config.h"
#include "Thread.hxx"
-#include "util/Error.hxx"
+#include "system/Error.hxx"
#ifdef ANDROID
#include "java/Global.hxx"
#endif
bool
-Thread::Start(void (*_f)(void *ctx), void *_ctx, Error &error)
+Thread::Start(void (*_f)(void *ctx), void *_ctx)
{
assert(!IsDefined());
@@ -35,10 +35,8 @@ Thread::Start(void (*_f)(void *ctx), void *_ctx, Error &error)
#ifdef WIN32
handle = ::CreateThread(nullptr, 0, ThreadProc, this, 0, &id);
- if (handle == nullptr) {
- error.SetLastError("Failed to create thread");
- return false;
- }
+ if (handle == nullptr)
+ throw MakeLastError("Failed to create thread");
#else
#ifndef NDEBUG
creating = true;
@@ -50,8 +48,7 @@ Thread::Start(void (*_f)(void *ctx), void *_ctx, Error &error)
#ifndef NDEBUG
creating = false;
#endif
- error.SetErrno(e, "Failed to create thread");
- return false;
+ throw MakeErrno(e, "Failed to create thread");
}
defined = true;
diff --git a/src/thread/Thread.hxx b/src/thread/Thread.hxx
index a276b4f3c..04860786f 100644
--- a/src/thread/Thread.hxx
+++ b/src/thread/Thread.hxx
@@ -31,8 +31,6 @@
#include <assert.h>
-class Error;
-
class Thread {
#ifdef WIN32
HANDLE handle = nullptr;
@@ -91,7 +89,7 @@ public:
#endif
}
- bool Start(void (*f)(void *ctx), void *ctx, Error &error);
+ bool Start(void (*f)(void *ctx), void *ctx);
void Join();
private: