Inheritance diagram for os::Thread:

Public Member Functions | |
| Thread (const char *pzName, int nPriority=NORMAL_PRIORITY, int nStackSize=0) | |
| Constructor. | |
| virtual | ~Thread () |
| void | Start () |
| Begin/Resume execution. | |
| void | Stop () |
| Suspend execution. | |
| void | WaitFor () |
| Wait for thread. | |
| void | Terminate () |
| Kill thread unconditionally. | |
| void | Initialize (const char *pzName, int nPriority=NORMAL_PRIORITY, int nStackSize=0) |
| Reset thread. | |
| void | SetPriority (int nPriority=IDLE_PRIORITY) |
| Set priority. | |
| int | GetPriority () |
| Get priority. | |
| thread_id | GetThreadId () |
| Get thread ID. | |
| proc_id | GetProcessId () |
| Get process ID. | |
| virtual int32 | Run (void)=0 |
| Thread code. | |
Protected Member Functions | |
| void | Delay (uint32 nMicros) |
| Temporarily suspend thread execution. | |
#include <util/thread.h> #include <stdio.h> // printf() #include <unistd.h> // sleep() using namespace os; class MyThread : public Thread { public: MyThread() : Thread( "MyThread" ) {} int32 Run() { for( int i = 0; i < 10000; i++ ) { Delay( 1000000 ); printf( "In the loop: %d\n", i ); } return 0; } }; int main(void) { MyThread thread; thread.Start(); printf( "The thread is running now!\n"); sleep( 10 ); // Let it run for 10 secs thread.Terminate(); return 0; }
| Thread::Thread | ( | const char * | pzName, | |
| int | nPriority = NORMAL_PRIORITY, |
|||
| int | nStackSize = 0 | |||
| ) |
| pzName | Name of the thread. | |
| nPriority | Thread priority (IDLE_PRIORITY, LOW_PRIORITY, NORMAL_PRIORITY, DISPLAY_PRIORITY, URGENT_DISPLAY_PRIORITY or REALTIME_PRIORITY). |
| Thread::~Thread | ( | ) | [virtual] |
| void Thread::Start | ( | void | ) |
| void Thread::Stop | ( | void | ) |
| void Thread::WaitFor | ( | void | ) |
| void Thread::Terminate | ( | void | ) |
| void Thread::Initialize | ( | const char * | pzName, | |
| int | nPriority = NORMAL_PRIORITY, |
|||
| int | nStackSize = 0 | |||
| ) |
| pzName | Name of the thread. | |
| nPriority | Thread priority (IDLE_PRIORITY, LOW_PRIORITY, NORMAL_PRIORITY, DISPLAY_PRIORITY, URGENT_DISPLAY_PRIORITY or REALTIME_PRIORITY). | |
| nStackSize | Stack size, 0 means default (currently 128k). Minimum stack size is currently 32k. |
| void Thread::SetPriority | ( | int | nPriority = IDLE_PRIORITY |
) |
| nPriority | Thread priority (IDLE_PRIORITY, LOW_PRIORITY, NORMAL_PRIORITY, DISPLAY_PRIORITY, URGENT_DISPLAY_PRIORITY or REALTIME_PRIORITY). |
| int Thread::GetPriority | ( | ) |
| thread_id Thread::GetThreadId | ( | ) |
| proc_id Thread::GetProcessId | ( | ) |
| virtual int32 os::Thread::Run | ( | void | ) | [pure virtual] |
Implemented in MountDialogScanner.
| void Thread::Delay | ( | uint32 | nMicros | ) | [protected] |
| nMicros | Delay time in microseconds. |
1.5.1