![]() |
Main Page
Class Hierarchy
Alphabetical List
Compound List
File List
Compound Members
![]() |
#include <FXThreadEvent.h>
Inheritance diagram for FXEX::FXThreadEvent::
Public Methods | |
FXThreadEvent (FXObject *tgt=NULL, FXSelector sel=0) | |
void | signal () |
void | signal (FXuint seltype) |
virtual | ~FXThreadEvent () |
Interthread communication object
------------------------------------------------------------------
Usage:
GUI_thread.h: ============
class MyGUI::FXWhatEver { // constructor MyGUI(...);
// message IDs enum { ID_THREAD_EVENT = FXWhatEver::ID_LAST, ID_LAST };
// message handler long onThreadEvent(FXObject*, FXSelector, void*);
// thread event object FXThreadEvent m_threadEvent; };
GUI_thread.cpp: ==============
// message map FXDEFMAP(MyGUI, FXWhatEver) = { FXMAPFUNC(SEL_THREAD_EVENT, MyGUI::ID_THREAD_EVENT, MyGUI::onThreadEvent) };
// constructor MyGUI::MyGUI(...) { m_threadEvent.setTarget(this), m_threadEvent.setSelector(ID_THREAD_EVENT); }
// message handler long onThreadEvent(FXObject*, FXSelector, void*) { do something with the GUI }
Worker_thread.cpp: =================
int threadFunction(...) { FXThreadEvent* pThreadEvent = (FXThreadEvent*)(ptr);
while (not_finished) { // work hard ...
// wake up GUI if (something_happened_and_the_GUI_needs_to_know_it) { pThreadEvent.signal(); } }
... }
Definition at line 103 of file FXThreadEvent.h.
|
Construct an object capable of signaling the main FOX event loop.
|
|
destructor.
|
|
Signal the event - using the SEL_THREAD FXSelector type. This is meant to be called from the worker thread - it sends a mesage to the target, which is in another thread. |
|
Signal the event - using the specified FXSelector. This is meant to be called from the worker thread - it sends a mesage to the target, which is in another thread. |