Kaydet (Commit) ebf3bb71 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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>.
üst bbb0dcaa
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
#include "sal/config.h" #include "sal/config.h"
#include <stdexcept>
#include <string>
#include "sal/log.hxx" #include "sal/log.hxx"
#include "salhelper/thread.hxx" #include "salhelper/thread.hxx"
...@@ -36,11 +39,13 @@ salhelper::Thread::Thread(char const * name): name_(name) {} ...@@ -36,11 +39,13 @@ salhelper::Thread::Thread(char const * name): name_(name) {}
void salhelper::Thread::launch() { void salhelper::Thread::launch() {
SAL_INFO("salhelper.thread", "launch " << name_); SAL_INFO("salhelper.thread", "launch " << name_);
// Assumption is that osl::Thread::create returns normally iff it causes // Assumption is that osl::Thread::create returns normally with a true
// osl::Thread::run to start executing: // return value iff it causes osl::Thread::run to start executing:
acquire(); acquire();
try { try {
create(); if (!create()) {
throw std::runtime_error("osl::Thread::create failed");
}
} catch (...) { } catch (...) {
release(); release();
throw; throw;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment