private Enqueue ( System.Action action ) : void | ||
action | System.Action | The action to enqueue. |
return | void |
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();
}