/// <summary> /// Enqueue an action in the pending queue. /// </summary> /// <param name="action">The action to enqueue.</param> /// <remarks>Spin-locks to update the queue.</remarks> void Enqueue(Action action) { bool queued = false; IPersistentStack prior = null; while (!queued) { prior = _q.Get(); queued = _q.CompareAndSet(prior, (IPersistentStack)prior.cons(action)); } if (prior.count() == 0) { action.execute(); } }
/// <summary> /// Gets the (immutable) value the reference is holding. /// </summary> /// <returns>The value</returns> public override object deref() { return(_state.Get()); }
public Exception getError() { return(_aq.Get()._error); }