public ScheduledWork(Actor a, Future f) { actor = a; future = f; }
internal void schedule(Actor a, Duration d, Future f) { m_scheduler.schedule(d.ticks(), new ScheduledWork(a, f)); }
internal void submit(Actor actor) { m_threadPool.submit(actor); }
////////////////////////////////////////////////////////////////////////// // When Done ////////////////////////////////////////////////////////////////////////// internal void sendWhenDone(Actor a, Future f) { // if already done, then set immediate flag // otherwise add to our when done list bool immediate = false; lock (this) { if (isDone()) immediate = true; else { if (whenDone == null) whenDone = new ArrayList(); whenDone.Add(new WhenDone(a, f)); } } // if immediate we are already done so enqueue immediately if (immediate) { try { a._enqueue(f, false); } catch (System.Exception e) { Err.dumpStack(e); } } }
public WhenDone(Actor a, Future f) { actor = a; future = f; }
public static void makeCoalescing_(Actor self, ActorPool pool, Func k, Func c) { makeCoalescing_(self, pool, k, c, null); }
public static void makeCoalescing_(Actor self, ActorPool pool, Func k, Func c, Func r) { if (k != null && !k.isImmutable()) throw NotImmutableErr.make("Coalescing toKey func not immutable: " + k).val; if (c != null && !c.isImmutable()) throw NotImmutableErr.make("Coalescing coalesce func not immutable: " + c).val; make_(self, pool, r); self.m_queue = new CoalescingQueue(k, c); }
public static Actor makeCoalescing(ActorPool pool, Func k, Func c, Func r) { Actor self = new Actor(); makeCoalescing_(self, pool, k, c, r); return self; }
public static Actor make(ActorPool pool, Func receive) { Actor self = new Actor(); make_(self, pool, receive); return self; }
internal Context(Actor actor) { m_actor = actor; }
public static void make_(Actor self, ActorPool pool, Func receive) { // check pool if (pool == null) throw NullErr.make("pool is null").val; // check receive method if (receive == null && self.@typeof().qname() == "concurrent::Actor") throw ArgErr.make("must supply receive func or subclass Actor").val; if (receive != null && !receive.isImmutable()) throw NotImmutableErr.make("Receive func not immutable: " + receive).val; // init self.m_pool = pool; self.m_receive = receive; self.m_queue = new Queue(); }
public static void make_(Actor self, ActorPool pool) { make_(self, pool, null); }