The Open Master Hearing Aid (openMHA)  openMHA
Open community platform for hearing aid algorithm research
MHAPlugin_Split::posix_threads_t Class Reference

Posix threads specification of thread platform. More...

Inheritance diagram for MHAPlugin_Split::posix_threads_t:
Inheritance graph

Public Member Functions

void kick_thread ()
 Start signal processing in separate thread. More...
 
void catch_thread ()
 Wait for signal processing to finish. More...
 
 posix_threads_t (uni_processor_t *proc, const std::string &thread_scheduler, int thread_priority)
 Constructor. More...
 
 ~posix_threads_t ()
 Terminate thread. More...
 
void main ()
 Thread main loop. Wait for process/termination trigger, then act. More...
 
- Public Member Functions inherited from MHAPlugin_Split::thread_platform_t
 thread_platform_t (uni_processor_t *proc)
 Constructor. More...
 
virtual ~thread_platform_t ()
 Make derived classes destructable via pointer to this base class. More...
 

Static Public Member Functions

static void * thread_start (void *thr)
 Thread start function. More...
 
static std::string current_thread_scheduler ()
 
static int current_thread_priority ()
 

Private Attributes

pthread_mutex_t mutex
 The mutex. More...
 
pthread_cond_t kick_condition
 The condition for signalling the kicking and termination. More...
 
pthread_cond_t catch_condition
 The condition for signalling the processing is finished. More...
 
pthread_attr_t attr
 Thread attributes. More...
 
struct sched_param priority
 Thread scheduling priority. More...
 
int scheduler
 
pthread_t thread
 The thread object. More...
 
bool kicked
 A flag that is set to true by kick_thread and to false by the thread after it has woken up from the kicking. More...
 
bool processing_done
 A flag that is set to true by the thread when it returns from processing and to false by catch_thread after it has waited for that return. More...
 
bool termination_request
 Set to true by the destructor. More...
 

Additional Inherited Members

- Protected Attributes inherited from MHAPlugin_Split::thread_platform_t
uni_processor_tprocessor
 A pointer to the plugin loader that processes the sound data in the channels for which this thread was created. More...
 

Detailed Description

Posix threads specification of thread platform.

Constructor & Destructor Documentation

◆ posix_threads_t()

MHAPlugin_Split::posix_threads_t::posix_threads_t ( uni_processor_t proc,
const std::string &  thread_scheduler,
int  thread_priority 
)
inline

Constructor.

Parameters
procPointer to the associated signal processor instance
thread_schedulerA string describing the posix thread scheduler. Possible values: "SCHED_OTHER", "SCHED_RR", "SCHED_FIFO".
thread_priorityThe scheduling priority of the new thread.

◆ ~posix_threads_t()

MHAPlugin_Split::posix_threads_t::~posix_threads_t ( )
inline

Terminate thread.

Member Function Documentation

◆ kick_thread()

void MHAPlugin_Split::posix_threads_t::kick_thread ( )
inlinevirtual

Start signal processing in separate thread.

Implements MHAPlugin_Split::thread_platform_t.

◆ catch_thread()

void MHAPlugin_Split::posix_threads_t::catch_thread ( )
inlinevirtual

Wait for signal processing to finish.

Implements MHAPlugin_Split::thread_platform_t.

◆ thread_start()

static void* MHAPlugin_Split::posix_threads_t::thread_start ( void *  thr)
inlinestatic

Thread start function.

◆ main()

void MHAPlugin_Split::posix_threads_t::main ( )
inline

Thread main loop. Wait for process/termination trigger, then act.

◆ current_thread_scheduler()

static std::string MHAPlugin_Split::posix_threads_t::current_thread_scheduler ( )
inlinestatic

◆ current_thread_priority()

static int MHAPlugin_Split::posix_threads_t::current_thread_priority ( )
inlinestatic

Member Data Documentation

◆ mutex

pthread_mutex_t MHAPlugin_Split::posix_threads_t::mutex
private

The mutex.

◆ kick_condition

pthread_cond_t MHAPlugin_Split::posix_threads_t::kick_condition
private

The condition for signalling the kicking and termination.

◆ catch_condition

pthread_cond_t MHAPlugin_Split::posix_threads_t::catch_condition
private

The condition for signalling the processing is finished.

◆ attr

pthread_attr_t MHAPlugin_Split::posix_threads_t::attr
private

Thread attributes.

◆ priority

struct sched_param MHAPlugin_Split::posix_threads_t::priority
private

Thread scheduling priority.

◆ scheduler

int MHAPlugin_Split::posix_threads_t::scheduler
private

◆ thread

pthread_t MHAPlugin_Split::posix_threads_t::thread
private

The thread object.

◆ kicked

bool MHAPlugin_Split::posix_threads_t::kicked
private

A flag that is set to true by kick_thread and to false by the thread after it has woken up from the kicking.

◆ processing_done

bool MHAPlugin_Split::posix_threads_t::processing_done
private

A flag that is set to true by the thread when it returns from processing and to false by catch_thread after it has waited for that return.

◆ termination_request

bool MHAPlugin_Split::posix_threads_t::termination_request
private

Set to true by the destructor.


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