diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-02-24 08:18:51 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-02-24 08:20:32 +0100 |
commit | ebf3bb71c325fb23b4519ce6478e9186d4e82927 (patch) | |
tree | 4f1aee44b92fc7afcbcc02efc23507de26afa379 /salhelper/source | |
parent | bbb0dcaa4ba4baf0c0489cf868f6002317beefe5 (diff) |
salhelper::Thread::launch: check create() failure
The assumption in the comment is clearly wrong, as osl::Thread::create
returns a boolean result to indicate failure.
Slight modification of a patch by Michael Stahl <mstahl@redhat.com>.
Diffstat (limited to 'salhelper/source')
-rw-r--r-- | salhelper/source/thread.cxx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/salhelper/source/thread.cxx b/salhelper/source/thread.cxx index bf7c1f196aa8..aaad063376f2 100644 --- a/salhelper/source/thread.cxx +++ b/salhelper/source/thread.cxx @@ -29,6 +29,9 @@ #include "sal/config.h" +#include <stdexcept> +#include <string> + #include "sal/log.hxx" #include "salhelper/thread.hxx" @@ -36,11 +39,13 @@ salhelper::Thread::Thread(char const * name): name_(name) {} void salhelper::Thread::launch() { SAL_INFO("salhelper.thread", "launch " << name_); - // Assumption is that osl::Thread::create returns normally iff it causes - // osl::Thread::run to start executing: + // Assumption is that osl::Thread::create returns normally with a true + // return value iff it causes osl::Thread::run to start executing: acquire(); try { - create(); + if (!create()) { + throw std::runtime_error("osl::Thread::create failed"); + } } catch (...) { release(); throw; |