pike.git / lib / modules / Concurrent.pmod

version» Context lines:

pike.git/lib/modules/Concurrent.pmod:1:   //! Module for handling multiple concurrent events. + //! + //! The @[Future] and @[Promise] API was inspired by + //! @url{https://github.com/couchdeveloper/FutureLib@}.    - /* -  * Inspired by https://github.com/couchdeveloper/FutureLib -  */ -  +    protected enum State {    STATE_PENDING = 0,    STATE_FULFILLED,    STATE_REJECTED,   };      protected Thread.Mutex mux = Thread.Mutex();   protected Thread.Condition cond = Thread.Condition();      //! Value that will be provided asynchronously
pike.git/lib/modules/Concurrent.pmod:323:    void maybe_failure(mixed value)    {    object key = mux->lock();    if (!state) return;    unlocked_failure(value);    }       protected void destroy()    {    if (!state) { -  failure(({ "Promise broken.\n", backtrace() })); +  unlocked_failure(({ "Promise broken.\n", backtrace() }));    }    }   }      protected class FirstCompleted   {    inherit Promise;       protected void create(array(Future) futures)    {