text: Simple thread handler. More...
  #include <simplethreadhandler.h>
  Simple thread handler.
  This class simplifies the handling of C11 threads.
  Usage: The class creating the thread has to be derived from SimpleThreadHandler and to overload the pure virtual workerFunction() with the code to be executed within the thread. The worker function should either return by itself or when cancelThread() becomes true. This means that the workerFunction() usually contains a while(not cancelThread()) loop.
  The thread is started by calling start(). By calling stop() the cancel flag is set and the thread will terminate after some time depending on the implementation of the workerFunction(). For keeping the thread idle in the workerFunction() call the member function msleep().
  Definition at line 53 of file simplethreadhandler.h.
  Constructor.
  The constructor sets the cancel-thread flag to false. It does not yet start the thread.
  Definition at line 36 of file simplethreadhandler.cpp.
  virtual destructor calls stop
  The destructor waits for the current thread to stop if it is running.
  Definition at line 48 of file simplethreadhandler.cpp.
  Cancel-flag getter method, thread-safe.
  Find out whether a thread has been registered for termination.
  Definition at line 73 of file simplethreadhandler.cpp.
  EPT exception handling.
  Called when an exception is caught during the worker function
  Reimplement this function if you want a custom exception handling, e.g. restart the thread. By default this function does nothing.
  Definition at line 145 of file simplethreadhandler.cpp.
  Flag to check if the thread is running.
  Definition at line 131 of file simplethreadhandler.cpp.
  Sleep function for staying idle.
  Call this function from the thread if you want to let it stay in an idle state without consuming CPU time.
  Definition at line 118 of file simplethreadhandler.cpp.
  Cancel-flag setter method, thread-safe.
  Register a thread for termination.
  Definition at line 60 of file simplethreadhandler.cpp.
  Specify the name of the thread.
  With this function it is possible to rename the thread. This is particularly useful for debugging since the Qt-creator shows the thread name in a list. However, there is no platform-independent implementation of thread name handling. Therefore, this function works only on Linux using the underlying pthread implementation. The function has to be called within the thread itself, i.e., in the worker function. It works only in debug mode.
  Definition at line 164 of file simplethreadhandler.cpp.
  Private helper function.
  This function calls the abstract workerFunction of the implementation. It also catches its exceptions-
  Definition at line 183 of file simplethreadhandler.cpp.
  Start the thread.
  If the thread is already running register it for termination and wait until it has terminated. Then restart a new thread.
  Definition at line 87 of file simplethreadhandler.cpp.
  Stop the thread.
  Mark the thread for cancellation. This function waits for termination of the thread, i.e. it blocks until the thread has been shut down. This waiting time will depend on the implementation of the workerFunction.
  Reimplemented in SignalAnalyzer.
  Definition at line 103 of file simplethreadhandler.cpp.
  Virtual worker function, executed within the new thread.
  Overload this function with the code to be executed within the new thread. Make sure that it either returns by itself or when cancelThread() becomes true. This means that a typical implementation of the workerFunction() should contain a while(not cancelThread()) loop.
  If you want the thread to stay idle call msleep.
  Implemented in SignalAnalyzer, WaveformGenerator, KeyRecognizer, and Algorithm.
  Cancel flag.
  Definition at line 95 of file simplethreadhandler.h.
  Mutex protecting the cancel flag.
  Definition at line 98 of file simplethreadhandler.h.
  Is the thread running.
  Definition at line 96 of file simplethreadhandler.h.
  Local thread member variable.
  Definition at line 97 of file simplethreadhandler.h.