thread/Thread: throw std::system_error on error
This commit is contained in:
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user