]> AND Private Git Repository - loba.git/blobdiff - msg_thread.cpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Be consistent and hold mutex in any case when returning from condition_t::timedwait().
[loba.git] / msg_thread.cpp
index 41c4bfbfaf548f765d49ed4fd21e6294ad54ad47..35ee01a4268eeaf476fe631155d85d43df8b9b5d 100644 (file)
@@ -23,14 +23,14 @@ msg_thread::msg_thread(const char* name)
 msg_thread::~msg_thread()
 {
     if (thread)
-        throw std::logic_error("trying to destroy running thread");
+        xbt_die("ERROR: trying to destroy running thread");
 }
 
 void msg_thread::start()
 {
     mutex.acquire();
     if (started)
-        throw std::logic_error("thread was already started");
+        xbt_die("ERROR: thread was already started");
     XBT_DEBUG("launch \"%s\"", thread_name.c_str());
     thread = MSG_process_create(thread_name.c_str(),
                                 msg_thread::start_wrapper,
@@ -43,7 +43,7 @@ void msg_thread::wait()
 {
     mutex.acquire();
     if (!started)
-        throw std::logic_error("trying to wait a thread that was not started");
+        xbt_die("ERROR: trying to wait for a thread that was not started");
     while (thread) {
         XBT_DEBUG("waiting for \"%s\" to terminate",
                   thread_name.c_str());