SPAOP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | List of all members
thread::Thread Class Referenceabstract

A wrapper for the std::thread wrapping it into a Java-style thread object. More...

#include <Thread.h>

Inheritance diagram for thread::Thread:
Inheritance graph
[legend]

Public Member Functions

 Thread ()
 Constructor. More...
 
virtual ~Thread ()
 Destructor. More...
 
void start ()
 Starts the Thread. More...
 
void stop ()
 Sets the internal flag stopped_ to true. More...
 
void join ()
 Joins the thread. More...
 

Protected Member Functions

virtual void run ()=0
 This is the method that will be executed by the thread. More...
 
bool isStopped () const
 Returns true if the thread was stopped. More...
 

Detailed Description

A wrapper for the std::thread wrapping it into a Java-style thread object.

Derived classes override the abstract run() method which will be exectued by the thread represented by this class.

Constructor & Destructor Documentation

thread::Thread::Thread ( )

Constructor.

thread::Thread::~Thread ( )
virtual

Destructor.

Member Function Documentation

bool thread::Thread::isStopped ( ) const
protected

Returns true if the thread was stopped.

Must be checked regularly from within run().

void thread::Thread::join ( )

Joins the thread.

virtual void thread::Thread::run ( )
protectedpure virtual

This is the method that will be executed by the thread.

In case this is implemented with a loop, isStopped() should be checked reguarly (and the loop shall be exited if isStopped() returns true).

Implemented in wonderlo::WonderOscSenderThread.

void thread::Thread::start ( )

Starts the Thread.

Calling this again the thread has been started already will have no effect. (That includes calling start() again after the thread has been joined.)

void thread::Thread::stop ( )

Sets the internal flag stopped_ to true.