Thread Class Reference

joinable thread, with overridden Sleep and Wait methods. More...

#include <thread.h>

Inherited by HttpDownloaderThread< ParentClass >, HttpDownloaderThread< UpdaterClass >, PingThread, TorrentMaintenanceThread, and WorkerThread.

Public Member Functions

 Thread ()
 ~Thread ()
 destructor Waits for thread to complete
ExitCode Wait ()
 overrides wxThread::Wait . Wakes up from sleep if sleeping, to prevent delay.
bool Sleep (int milliseconds)
 returns false when woken up
void WakeUp ()
 call this from outside thread to wake up Sleep - ing thread
bool TestDestroy ()
 overrides wxThread::TestDestroy , which can fail on Wait
wxThreadError Run ()

Protected Attributes

wxSemaphore m_thread_sleep_semaphore
bool m_must_exit
 workaround for old wxWidgets bug

Detailed Description

joinable thread, with overridden Sleep and Wait methods.

Sleep wakes up when you call Wait()

Definition at line 41 of file thread.h.


Constructor & Destructor Documentation

Thread::Thread (  ) 

Definition at line 70 of file thread.cpp.

Thread::~Thread (  ) 

destructor Waits for thread to complete

TODO this causes a segfault on exit for me (koshi) sometimes http://docs.wxwidgets.org/stable/wx_wxthread.html#wxthreadwait says to only call wxThread::Wait from another thread context.

Definition at line 81 of file thread.cpp.


Member Function Documentation

wxThreadError Thread::Run (  ) 

Definition at line 100 of file thread.cpp.

bool Thread::Sleep ( int  milliseconds  ) 

returns false when woken up

Definition at line 85 of file thread.cpp.

bool Thread::TestDestroy (  ) 

overrides wxThread::TestDestroy , which can fail on Wait

Reimplemented in HttpDownloaderThread< ParentClass >, TorrentMaintenanceThread, and HttpDownloaderThread< UpdaterClass >.

Definition at line 105 of file thread.cpp.

Thread::ExitCode Thread::Wait (  ) 

overrides wxThread::Wait . Wakes up from sleep if sleeping, to prevent delay.

Definition at line 94 of file thread.cpp.

void Thread::WakeUp (  ) 

call this from outside thread to wake up Sleep - ing thread

Definition at line 90 of file thread.cpp.


Field Documentation

bool Thread::m_must_exit [protected]

workaround for old wxWidgets bug

Definition at line 60 of file thread.h.

wxSemaphore Thread::m_thread_sleep_semaphore [protected]

Definition at line 58 of file thread.h.


The documentation for this class was generated from the following files:

Generated on Thu Dec 29 00:11:49 2011 for SpringLobby by doxygen 1.6.3