18 #ifndef SHEVEK_CLOSURE_HH
19 #define SHEVEK_CLOSURE_HH
39 enum state_t { EMPTY, BLOCKING, RUNNING } state;
40 sigc::slot0 <void> callback,
function;
44 void do_write (
int *fds);
45 void do_read (
int *fds);
46 static void *start_wrapper (
void *me);
52 static Glib::RefPtr <closure>
create ()
53 {
return Glib::RefPtr <closure> (
new closure ()); }
58 bool empty ()
const {
return state == EMPTY; }
64 void set_function (sigc::slot0 <void> func,
bool run =
true,
65 sigc::slot0 <void> cb = sigc::slot0 <void> ());
Base class for classes which want reference counting through Glib::RefPtr.
Definition: refbase.hh:27
void wake()
Continue running the closure.
Block and resume without blocking the main loop.
Definition: closure.hh:36
static Glib::RefPtr< closure > create()
Create a new closure.
Definition: closure.hh:52
bool empty() const
Check if the closure is empty.
Definition: closure.hh:58
void set_function(sigc::slot0< void > func, bool run=true, sigc::slot0< void > cb=sigc::slot0< void >())
Set running function on an empty closure.
static void block()
Sleep, returning control to the caller until awoken.