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.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/stable/thread.h') diff --git a/src/stable/thread.h b/src/stable/thread.h index f4b961f..0a0d8bb 100644 --- a/src/stable/thread.h +++ b/src/stable/thread.h @@ -10,8 +10,11 @@ #include +#include "bu/exceptionbase.h" + namespace Bu { + subExceptionDecl( ThreadException ); class ThreadId { friend class Thread; @@ -49,6 +52,7 @@ namespace Bu virtual ~Thread(); static ThreadId currentThread(); + ThreadId getId() { return ThreadId( ptHandle ); } /** * Begin thread execution. This will call the overridden run function, @@ -93,12 +97,11 @@ namespace Bu private: pthread_t ptHandle; /**< Internal handle to the posix thread. */ - int nHandle; /**< Numeric handle to the posix thread. */ protected: /** - * The workhorse of the Thread class. This is the function that will run - * in the thread, when this function exits the thread dies and is + * The workhorse of the Thread class. This is the function that will + * run in the thread, when this function exits the thread dies and is * cleaned up by the system. Make sure to read up on ThreadMutex, * ThreadCondition, and cancel to see how to control and protect * everything you do in a safe way within this function. -- cgit v1.2.3