public static void Continue(Primitive prim, Primitive.Callback cb, int timeoutMs = -1) { Primitive.WhenSignalled(prim, (pr) => ThreadPool.QueueUserWorkItem((obj) => cb(pr)), timeoutMs); }
// Reschedule the Gtk handler to be run when the primitive // becomes ready. This is only done if we need to do this and // the handler hasn't already been scheduled. void listen() { if (enabled && !listening) { Primitive.WhenSignalled(Primitive, (p) => Gtk.Application.Invoke(gtkHandler)); } }
public static Primitive Wait(Primitive[] prims, int timeoutMs = -1) { var s = new Sync(); Primitive.WhenSignalled(prims, s.Send, timeoutMs); return(s.Recv()); }
public static Task <Primitive> WaitAsync(Primitive[] prims, int timeoutMs = -1) { var tsc = new TaskCompletionSource <Primitive>(); Primitive.WhenSignalled(prims, (src) => tsc.SetResult(src), timeoutMs); return(tsc.Task); }