[PATCH] salhelper::Thread::launch: check create() failure
Michael Stahl
mstahl at redhat.com
Thu Feb 23 05:53:56 PST 2012
The assumption in the comment is clearly wrong, as osl::Thread::create
returns a boolean result to indicate failure.
---
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 bf7c1f1..d1644be 100644
--- a/salhelper/source/thread.cxx
+++ b/salhelper/source/thread.cxx
@@ -32,15 +32,20 @@
#include "sal/log.hxx"
#include "salhelper/thread.hxx"
+#include <stdexcept>
+
+
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:
acquire();
try {
- create();
+ bool const bSuccess = create();
+ if (!bSuccess) {
+ // cannot throw css::uno::RuntimeException (udkapi not available)
+ throw ::std::runtime_error("osl::Thread::create() failed");
+ }
} catch (...) {
release();
throw;
--
1.7.7.6
--------------050901090703010909090003--
More information about the LibreOffice
mailing list