aboutsummaryrefslogtreecommitdiff
path: root/src/stable/thread.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-04-06 18:57:05 +0000
committerMike Buland <eichlan@xagasoft.com>2012-04-06 18:57:05 +0000
commit9a602d38035972e6aabfb3bb4da2b1ee53f9f7be (patch)
treedc4485da7853538cc251610f26ffd6a700b30143 /src/stable/thread.cpp
parentb7745f00eacb2ca5b9c56331006f4f37d2566fdc (diff)
downloadlibbu++-9a602d38035972e6aabfb3bb4da2b1ee53f9f7be.tar.gz
libbu++-9a602d38035972e6aabfb3bb4da2b1ee53f9f7be.tar.bz2
libbu++-9a602d38035972e6aabfb3bb4da2b1ee53f9f7be.tar.xz
libbu++-9a602d38035972e6aabfb3bb4da2b1ee53f9f7be.zip
Threads can tell you their own ids now, and they can also report that they
failed to start.
Diffstat (limited to 'src/stable/thread.cpp')
-rw-r--r--src/stable/thread.cpp7
1 files changed, 6 insertions, 1 deletions
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 @@
9 9
10#include "bu/config.h" 10#include "bu/config.h"
11 11
12namespace Bu { subExceptionDef( ThreadException ); }
13
12Bu::ThreadId::ThreadId( pthread_t tId ) : 14Bu::ThreadId::ThreadId( pthread_t tId ) :
13 tId( tId ) 15 tId( tId )
14{ 16{
@@ -43,7 +45,10 @@ Bu::ThreadId Bu::Thread::currentThread()
43 45
44bool Bu::Thread::start() 46bool Bu::Thread::start()
45{ 47{
46 nHandle = pthread_create( &ptHandle, NULL, threadRunner, this ); 48 if( pthread_create( &ptHandle, NULL, threadRunner, this ) )
49 {
50 throw Bu::ThreadException("Could not start thread.");
51 }
47 52
48 return true; 53 return true;
49} 54}