Thread handling class for OpenFlipper.
Instantiate this class in order to provide a thread to a plugin. Unless you don't need a specialized run() or cancel() function, it won't be necessary to reimplement this class. Just connect the signals for the thread to work properly.
Note: Updating GUI elements of the main window from within a thread which is not the main thread can cause unexpected crashes to OpenFlipper. This introduces some major limitations to the usage of threads in plugins. These include avoiding the creation of new objects and generally every function that produces logging messages.
The class should be used along with Process Interface
It is not necessary to derive from this class for most operations, but you can.
Definition at line 83 of file OpenFlipperThread.hh.
||_jobId = |
If you do not specialize the OpenFlipperThread, The function connected to this signal will be used as the processing function for your thread. When you call
You have connect one of your slot using
The default implementation will call your slot inside the new thread and the core will still respond.
The optional parameter contains the job's id. In some cases the function that is to be called needs the job's id for further processing (status updates, etc.)
Semaphore to control order of thread startup calls.
This variable is used to control the order of thread startup calls. The Thread itself is started, and when it is up and running, the resource will be created. The core thread waits for this resource and afterwards starts execution of the threads processing function. Without this sync, the processing call of the main thread might get lost as the thread is not online and listening for the signal.
Definition at line 228 of file OpenFlipperThread.hh.