CodeLite/clJoinableThread.cpp
raw| 1 | #include "clJoinableThread.h" |
| 2 | |
| 3 | clJoinableThread::clJoinableThread() |
| 4 | : wxThread(wxTHREAD_JOINABLE) |
| 5 | { |
| 6 | } |
| 7 | |
| 8 | clJoinableThread::~clJoinableThread() { Stop(); } |
| 9 | |
| 10 | void clJoinableThread::Stop() |
| 11 | { |
| 12 | // Notify the thread to exit and |
| 13 | // wait for it |
| 14 | if(IsAlive()) { |
| 15 | Delete(NULL, wxTHREAD_WAIT_BLOCK); |
| 16 | |
| 17 | } else { |
| 18 | Wait(wxTHREAD_WAIT_BLOCK); |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | void clJoinableThread::Start(int priority) |
| 23 | { |
| 24 | Create(); |
| 25 | SetPriority(priority); |
| 26 | Run(); |
| 27 | } |