diff options
Diffstat (limited to 'src/stable/thread.h')
| -rw-r--r-- | src/stable/thread.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/stable/thread.h b/src/stable/thread.h index 70e6f5f..f4b961f 100644 --- a/src/stable/thread.h +++ b/src/stable/thread.h | |||
| @@ -12,6 +12,22 @@ | |||
| 12 | 12 | ||
| 13 | namespace Bu | 13 | namespace Bu |
| 14 | { | 14 | { |
| 15 | class ThreadId | ||
| 16 | { | ||
| 17 | friend class Thread; | ||
| 18 | private: | ||
| 19 | ThreadId( pthread_t tId ); | ||
| 20 | |||
| 21 | public: | ||
| 22 | ThreadId(); | ||
| 23 | |||
| 24 | bool operator==( const ThreadId &rhs ); | ||
| 25 | bool operator!=( const ThreadId &rhs ); | ||
| 26 | |||
| 27 | private: | ||
| 28 | pthread_t tId; | ||
| 29 | }; | ||
| 30 | |||
| 15 | /** | 31 | /** |
| 16 | * Simple thread class. This wraps the basic pthread (posix threads) | 32 | * Simple thread class. This wraps the basic pthread (posix threads) |
| 17 | * system in an object oriented sort of way. It allows you to create a | 33 | * system in an object oriented sort of way. It allows you to create a |
| @@ -32,6 +48,8 @@ namespace Bu | |||
| 32 | */ | 48 | */ |
| 33 | virtual ~Thread(); | 49 | virtual ~Thread(); |
| 34 | 50 | ||
| 51 | static ThreadId currentThread(); | ||
| 52 | |||
| 35 | /** | 53 | /** |
| 36 | * Begin thread execution. This will call the overridden run function, | 54 | * Begin thread execution. This will call the overridden run function, |
| 37 | * which will simply execute in it's own thread until the function | 55 | * which will simply execute in it's own thread until the function |
| @@ -100,7 +118,6 @@ namespace Bu | |||
| 100 | static void *threadRunner( void *pThread ); | 118 | static void *threadRunner( void *pThread ); |
| 101 | 119 | ||
| 102 | void yield(); | 120 | void yield(); |
| 103 | |||
| 104 | }; | 121 | }; |
| 105 | } | 122 | } |
| 106 | 123 | ||
