Audio Processing Framework (APF) version 0.5.0
|
Manage command queue from non-realtime thread to realtime thread. More...
#include <apf/commandqueue.h>
Classes | |
struct | Command |
Abstract base class for realtime commands. More... | |
class | WaitCommand |
Dummy command to synchronize with non-realtime thread. More... | |
Public Member Functions | |
Functions to be called from the non-realtime thread | |
If there are multiple non-realtime threads, access has to be locked! | |
CommandQueue (size_t size) | |
Constructor. More... | |
~CommandQueue () | |
Destructor. More... | |
void | push (Command *cmd) |
Push a command to be executed in the realtime thread. More... | |
void | wait () |
Wait for realtime thread. More... | |
void | cleanup_commands () |
Clean up all commands in the cleanup-queue. More... | |
bool | deactivate () |
Deactivate queue; process following commands in the non-realtime thread. More... | |
void | reactivate () |
Re-activate queue. More... | |
Functions to be called from the realtime thread | |
void | process_commands () |
Execute all commands in the queue. More... | |
bool | commands_available () const |
Check if commands are available. More... | |
Manage command queue from non-realtime thread to realtime thread.
Commands can be added in the non-realtime thread with push().
Commands are executed when process_commands() is called from the realtime thread.
Definition at line 48 of file commandqueue.h.
|
inlineexplicit |
Constructor.
size | maximum number of commands in queue. |
Definition at line 88 of file commandqueue.h.
|
inline |
Destructor.
Definition at line 97 of file commandqueue.h.
References cleanup_commands().
|
inline |
Push a command to be executed in the realtime thread.
The command will be cleaned up when it comes back from the realtime thread. If the CommandQueue is inactive, the command is not queued but executed and cleaned up immediately.
cmd | The command to be executed. |
Definition at line 192 of file commandqueue.h.
References cleanup_commands(), and apf::CommandQueue::Command::execute().
Referenced by wait().
|
inline |
Wait for realtime thread.
Push an empty command and wait for its return.
Definition at line 219 of file commandqueue.h.
References cleanup_commands(), and push().
|
inline |
Clean up all commands in the cleanup-queue.
Definition at line 110 of file commandqueue.h.
Referenced by deactivate(), push(), reactivate(), wait(), and ~CommandQueue().
|
inline |
Deactivate queue; process following commands in the non-realtime thread.
Definition at line 121 of file commandqueue.h.
References cleanup_commands().
Referenced by apf::MimoProcessor< Derived, interface_policy, query_policy >::MimoProcessor().
|
inline |
Re-activate queue.
Definition at line 129 of file commandqueue.h.
References cleanup_commands().
|
inline |
Execute all commands in the queue.
After execution, the commands are queued for cleanup in the non-realtime thread.
Definition at line 145 of file commandqueue.h.
References apf::CommandQueue::Command::execute().
|
inline |
Check if commands are available.
Definition at line 161 of file commandqueue.h.