GNU Radio 3.3.0 C++ API
cond_init.h File Reference
#include "sync_utils.h"
#include "cond.h"
#include <spu_mfcio.h>
Include dependency graph for spu_source/cond_init.h:

Go to the source code of this file.

Functions

static __inline void _cond_init (cond_ea_t cond)

Function Documentation

static __inline void _cond_init ( cond_ea_t  cond) [static]

cond_init - initialize condition variable. : handle to effective address of condition variable.

Conditional Variable - is a synchronization device that allows SPE and PPE threads to suspend execution and relinquish the processors until some predicate on shared data is satisfied. The basic operations on conditions are: signal the condition (when the predicate becomes true), and wait for the condition, suspending the thread execution until anoter thread signals the condition

A condition variable must always be associated with a mutex, to avoid the race condition where a thread prepares to wait on a condition variable and another thread signals the condition just before the first thread actually waits on it.

cond_init initializes the condition variable cond.

cond_signal restarts one of the threads that are waiting on the condition variable cond. If no threads are waiting on cond, nothing happens. If several threads are waiting on cond, exactly one is restarted, but it is not specified which

cond_broadcast restarts all the threads that are waiting on the condition variable cond. Nothing happens if no threads are waiting on cond

cond_wait atomically unlocks the mutex and waits for the condition variable cond to be signaled. The mutex must be lock locked by the calling thread on the entrance to cond_wait. Before returning to the calling thread, cond_wait re-acquires mutex.

Only one thread initializes a condition variable. Usually, the PPE thread initializes a condidtion variable, however, a cond_init function is provided here for completeness

Description: Initialize a cond variable to false.

References ALIGN, ALIGN128_EA, MFC_DMA, OFFSET128_EA_U16, and addr64::ull.