#include <BaseThread.h>
Inheritance diagram for vpr::BaseThread:


Public Types | |
| enum | VPRThreadPriority { VPR_PRIORITY_LOW, VPR_PRIORITY_NORMAL, VPR_PRIORITY_HIGH, VPR_PRIORITY_URGENT } |
| enum | VPRThreadScope { VPR_LOCAL_THREAD, VPR_GLOBAL_THREAD } |
| enum | VPRThreadState { VPR_JOINABLE_THREAD, VPR_UNJOINABLE_THREAD } |
Public Methods | |
| BaseThread () | |
| virtual | ~BaseThread () |
| virtual void | setFunctor (BaseThreadFunctor *functorPtr)=0 |
| Sets the thread's functor--the code that will get executed. More... | |
| virtual vpr::ReturnStatus | start ()=0 |
| Starts the thread's execution. More... | |
| TSTable * | getTSTable () |
| Gets the Thread specific data table. More... | |
| virtual int | join (void **status=0) |
| Causes the calling thread wait for the termination of this thread. More... | |
| virtual int | resume () |
| Resumes the execution of this thread (if it was previously suspended using suspend()). More... | |
| virtual int | suspend () |
| Suspends the execution of this thread. More... | |
| virtual int | getPrio (VPRThreadPriority *prio) |
| Gets this thread's current priority. More... | |
| virtual int | setPrio (VPRThreadPriority prio) |
| Sets this thread's priority. More... | |
| vpr::Int32 | getTID () |
| Gets the "thread ID" of this vpr::BaseThread object. More... | |
| bool | valid () |
| Is this a valid thread? More... | |
| virtual int | kill (int signum) |
| Sends the specified signal to this thread (not necessarily SIGKILL). More... | |
| virtual void | kill () |
| Kill (cancel) this thread. More... | |
| virtual std::ostream & | outStream (std::ostream &out) |
| Ouputs the state of the object. More... | |
Static Public Methods | |
| TSTable * | getGlobalTSTable () |
| Get the Thread the global thread specific data table. More... | |
Protected Methods | |
| void | registerThread (bool succesfulCreation) |
| After the object has been created, call this routine to complete initialization. More... | |
| void | createThreadId () |
| Initializes the state of the object. More... | |
Definition at line 72 of file BaseThread.h.
|
|
Definition at line 75 of file BaseThread.h.
00076 {
00077 VPR_PRIORITY_LOW,
00078 VPR_PRIORITY_NORMAL,
00079 VPR_PRIORITY_HIGH,
00080 VPR_PRIORITY_URGENT
00081 };
|
|
|
Definition at line 83 of file BaseThread.h.
00084 {
00085 VPR_LOCAL_THREAD,
00086 VPR_GLOBAL_THREAD
00087 };
|
|
|
Definition at line 89 of file BaseThread.h.
00090 {
00091 VPR_JOINABLE_THREAD,
00092 VPR_UNJOINABLE_THREAD
00093 };
|
|
|
Definition at line 95 of file BaseThread.h. Referenced by vpr::ThreadSGI::self, vpr::ThreadPosix::self, and vpr::ThreadNSPR::self.
00095 : mThreadId(-1)
00096 {
00097 ;
00098 }
|
|
|
Definition at line 100 of file BaseThread.h.
00101 {
00102 ;
00103 }
|
|
|
Sets the thread's functor--the code that will get executed.
Implemented in vpr::ThreadNSPR. |
|
|
Starts the thread's execution.
Implemented in vpr::ThreadNSPR. |
|
|
Gets the Thread specific data table. NOTE: Users should NOT access the table directly instead, use vpr::TSObjectProxies. Definition at line 117 of file BaseThread.h.
00118 {
00119 return &mTSTable;
00120 }
|
|
|
Get the Thread the global thread specific data table. This table is shared by all threads that were not created by vpr. Definition at line 126 of file BaseThread.h.
00127 {
00128 return &gTSTable;
00129 }
|
|
|
After the object has been created, call this routine to complete initialization. Done this way, because I need to call this based on stuff that happens in derived class's constructor.
Definition at line 77 of file BaseThread.cpp. References createThreadId. Referenced by vpr::ThreadSGI::start, vpr::ThreadPosix::start, vpr::ThreadNSPR::start, and vpr::ThreadPosix::startThread.
00078 {
00079 if(succesfulCreation) // Succeed
00080 {
00081 createThreadId();
00082 ThreadManager::instance()->addThread(this); // Add the thread to the table
00083 }
00084 else
00085 {
00086 mThreadId = -1; // We have an invalid thread
00087 }
00088 }
|
|
|
Causes the calling thread wait for the termination of this thread.
Reimplemented in vpr::ThreadNSPR. Definition at line 202 of file BaseThread.h.
00203 {
00204 boost::ignore_unused_variable_warning(status);
00205 return -1;
00206 }
|
|
|
Resumes the execution of this thread (if it was previously suspended using suspend()).
Reimplemented in vpr::ThreadNSPR. Definition at line 215 of file BaseThread.h.
00216 {
00217 return -1;
00218 }
|
|
|
Suspends the execution of this thread.
Reimplemented in vpr::ThreadNSPR. Definition at line 226 of file BaseThread.h.
00227 {
00228 return -1;
00229 }
|
|
|
Gets this thread's current priority.
Reimplemented in vpr::ThreadNSPR. Definition at line 244 of file BaseThread.h.
00245 {
00246 boost::ignore_unused_variable_warning(prio);
00247 return -1;
00248 }
|
|
|
Sets this thread's priority.
Reimplemented in vpr::ThreadNSPR. Definition at line 258 of file BaseThread.h.
00259 {
00260 boost::ignore_unused_variable_warning(prio);
00261 return -1;
00262 }
|
|
|
Gets the "thread ID" of this vpr::BaseThread object. This is a unique integer value assigned when the thread was created.
Definition at line 272 of file BaseThread.h. Referenced by vpr::ThreadNSPR::start.
00273 {
00274 return mThreadId;
00275 }
|
|
|
Is this a valid thread?
Definition at line 288 of file BaseThread.h.
00289 {
00290 return (mThreadId != -1);
00291 }
|
|
|
Sends the specified signal to this thread (not necessarily SIGKILL).
Reimplemented in vpr::ThreadNSPR. Definition at line 303 of file BaseThread.h.
00304 {
00305 boost::ignore_unused_variable_warning(signum);
00306 return -1;
00307 }
|
|
|
Kill (cancel) this thread.
Reimplemented in vpr::ThreadNSPR. Definition at line 315 of file BaseThread.h.
00316 {;}
|
|
|
Ouputs the state of the object.
Reimplemented in vpr::ThreadNSPR. Definition at line 321 of file BaseThread.h.
00322 {
00323 out.setf(std::ios::right);
00324 out << std::setw(3) << mThreadId;
00325 out.unsetf(std::ios::right);
00326 return out;
00327 }
|
|
|
Initializes the state of the object.
Definition at line 333 of file BaseThread.h. Referenced by registerThread.
00334 {
00335 mThreadId = getNextThreadId();
00336 }
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002