transient sclass RSTOverQ implements Runnable { Runnable runnable; Q q = startQ(); F0 enter; // optional ownership marker, e.g. for DynModules bool trigger, running; *(Runnable *runnable) {} *(Runnable *runnable, Q *q) { assertNotNull(q); } *(Q q, Runnable runnable) { this(runnable, q); } void trigger() { go(); } synchronized void go() { if (trigger) ret; trigger = true; q.add(r _run); } public void run() { go(); } void get() { go(); } // so you can use the ! syntax synchronized bool running() { ret running; } void _run() { synchronized(this) { if (!trigger) ret; running = true; trigger = false; } try { temp callF(enter); pcallF(runnable); } finally { synchronized(this) { running = false; } } } synchronized bool triggered() { ret trigger; } void waitUntilDone { while (running()) sleep(1); } S stats() { ret renderVars(+trigger, +running, +q, +runnable); } }