9 #ifndef THREADHANDLER_H_
10 #define THREADHANDLER_H_
A ThreadHandler is a Handler which runs in its own thread.
Definition: ThreadHandler.h:25
void cancelThread(void)
A "soft exit", requests the thread end on next loop.
Definition: ThreadHandler.cpp:235
bool cancelled_
Keeps track of the "cancelled" signal from cancelThread.
Definition: ThreadHandler.h:89
virtual void run()
Overrides Handler::run().
Definition: ThreadHandler.cpp:114
virtual void runInThread()
The new replacement for Handler::run() which runs in the thread., Run from the static threadEntryPoin...
Definition: ThreadHandler.cpp:145
static int PthreadJoinTimeout(pthread_t wid, unsigned int msecs, Component &component)
Definition: ThreadHandler.cpp:56
ThreadHandler(Component &inComponent, const Str &name, bool idleThread)
Constructor.
Definition: ThreadHandler.cpp:92
virtual bool continueLoop(void)
Evaluates additional thread-specific continue conditions.
Definition: ThreadHandler.cpp:168
static void ThreadCleanup(void *me)
A static entry point for a cleanup callback.
Definition: ThreadHandler.cpp:176
pthread_t threadID_
The thread ID.
Definition: ThreadHandler.h:97
Replacement for standard template class string.
Definition: Str.h:12
const pthread_t & getThreadId()
Definition: ThreadHandler.h:81
void joinThread(void)
Join the thread.
Definition: ThreadHandler.cpp:243
Base class for "handlers" of Components.
Definition: Handler.h:49
void cleanup(void)
A member function for the cleanup callback (called from threadCleanup)
Definition: ThreadHandler.cpp:184
Abstract Base class for software components.
Definition: Component.h:53
Contains the Mutex, ThreadCondition, and MutexLocker class declarations.
Contains the Handler class declaration.
static void * ThreadEntryPoint(void *me)
The entry point for the new thread. A static function.
Definition: ThreadHandler.cpp:128
virtual ~ThreadHandler()
Destructor.
Definition: ThreadHandler.cpp:100
pthread_attr_t threadAttributes_
the thread attributes
Definition: ThreadHandler.h:100
virtual void shutdown(void)
Cleanup the component (typically called from outside component)
Definition: ThreadHandler.cpp:194
void killThread(void)
End the thread immediately (uses pthread_cancel)
Definition: ThreadHandler.cpp:267
void exitThread(void)
Called by the thread to end itself (pthread_Exit)
Definition: ThreadHandler.cpp:216