Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

Raul::Thread Class Reference
[Realtime Audio Utility Library]

Abstract base class for a thread. More...

#include <Thread.hpp>

Inherited by Raul::Slave.

List of all members.

Public Member Functions

virtual void start ()
 Launch and start the thread.
virtual void stop ()
 Stop and terminate the thread.
virtual void join ()
void set_scheduling (int policy, unsigned int priority)
const std::string & name () const
void set_name (const std::string &name)
bool is_context (unsigned context) const
void set_context (unsigned context)

Static Public Member Functions

static Threadcreate (const std::string &name="")
static Threadcreate_for_this_thread (const std::string &name="")
 Must be called from thread.
static Threadget ()
 Return the calling thread.

Protected Member Functions

 Thread (const std::string &name="")
 Thread (pthread_t thread, const std::string &name="")
 Must be called from thread.
virtual void _run ()
 Thread function to execute.

Protected Attributes

bool _exit_flag

Detailed Description

Abstract base class for a thread.

Extend this and override the _run method to easily create a thread to perform some task.

The current Thread can be accessed using the get() method.


Member Function Documentation

Thread & Raul::Thread::get (  )  [static]

Return the calling thread.

The return value of this should NOT be cached unless the thread is explicitly user created with create().

void Raul::Thread::start (  )  [virtual]

Launch and start the thread.

void Raul::Thread::stop (  )  [virtual]

Stop and terminate the thread.

virtual void Raul::Thread::_run (  )  [inline, protected, virtual]

Thread function to execute.

This is called once on start, and terminated on stop. Implementations likely want to put some infinite loop here.

When _exit_flag becomes true (via a call to stop()) the loop should exit.


The documentation for this class was generated from the following files: