Ardour
9.0-pre0-582-g084a23a80d
|
#include <crossthread.h>
Public Member Functions | |
CrossThreadChannel (bool non_blocking) | |
~CrossThreadChannel () | |
void | wakeup () |
int | deliver (char msg) |
int | receive (char &msg, bool wait=false) |
void | drain () |
void | set_receive_handler (sigc::slot< bool, Glib::IOCondition > s) |
void | attach (Glib::RefPtr< Glib::MainContext >) |
Private Member Functions | |
bool | poll_for_request () |
Private Attributes | |
GIOChannel * | receive_channel |
GSource * | receive_source |
sigc::slot< bool, Glib::IOCondition > | receive_slot |
int | fds [2] |
Friends | |
gboolean | cross_thread_channel_call_receive_slot (GIOChannel *, GIOCondition condition, void *data) |
A simple abstraction of a mechanism of signalling one thread from another. The signaller calls wakeup() to tell the signalled thread to check for work to be done.
This implementation provides both selectable() for use in direct poll/select-based event loops, and a Glib::IOSource via ios() for use in Glib main loop based situations.
Definition at line 44 of file crossthread.h.
CrossThreadChannel::CrossThreadChannel | ( | bool | non_blocking | ) |
if non_blocking is true, the channel will not cause blocking when used in an event loop based on poll/select or the glib main loop.
CrossThreadChannel::~CrossThreadChannel | ( | ) |
void CrossThreadChannel::attach | ( | Glib::RefPtr< Glib::MainContext > | ) |
int CrossThreadChannel::deliver | ( | char | msg | ) |
void CrossThreadChannel::drain | ( | ) |
empty the channel of all requests. Typically this is done as soon as input is noticed on the channel, because the handler will look at a separately managed work queue. The actual number of queued "wakeups" in the channel will not be important.
|
private |
int CrossThreadChannel::receive | ( | char & | msg, |
bool | wait = false |
||
) |
void CrossThreadChannel::set_receive_handler | ( | sigc::slot< bool, Glib::IOCondition > | s | ) |
void CrossThreadChannel::wakeup | ( | ) |
Tell the listening thread that is has work to do.
|
friend |
|
private |
Definition at line 97 of file crossthread.h.
|
private |
Definition at line 90 of file crossthread.h.
|
private |
Definition at line 92 of file crossthread.h.
|
private |
Definition at line 91 of file crossthread.h.