From 9a602d38035972e6aabfb3bb4da2b1ee53f9f7be Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 6 Apr 2012 18:57:05 +0000 Subject: Threads can tell you their own ids now, and they can also report that they failed to start. --- src/stable/thread.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/stable/thread.cpp') diff --git a/src/stable/thread.cpp b/src/stable/thread.cpp index 0d0b768..9cf223e 100644 --- a/src/stable/thread.cpp +++ b/src/stable/thread.cpp @@ -9,6 +9,8 @@ #include "bu/config.h" +namespace Bu { subExceptionDef( ThreadException ); } + Bu::ThreadId::ThreadId( pthread_t tId ) : tId( tId ) { @@ -43,7 +45,10 @@ Bu::ThreadId Bu::Thread::currentThread() bool Bu::Thread::start() { - nHandle = pthread_create( &ptHandle, NULL, threadRunner, this ); + if( pthread_create( &ptHandle, NULL, threadRunner, this ) ) + { + throw Bu::ThreadException("Could not start thread."); + } return true; } -- cgit v1.2.3