public void post(Action action) { MsgQueueNode <Action> newNode = new MsgQueueNode <Action>(action); Monitor.Enter(this); if (_locked) { _waitQueue.AddLast(newNode); Monitor.Exit(this); } else { _locked = true; _readyQueue.AddLast(newNode); Monitor.Exit(this); next_a_round(); } }
public void post(Action action) { MsgQueueNode <Action> newNode = new MsgQueueNode <Action>(action); _mutex.enter(); if (_locked) { _waitQueue.AddLast(newNode); _mutex.exit(); } else { _locked = true; _readyQueue.AddLast(newNode); _mutex.exit(); run_task(); } }
public void post(Action handler) { MsgQueueNode <Action> newNode = new MsgQueueNode <Action>(handler); Monitor.Enter(_opQueue); _opQueue.AddLast(newNode); if (0 != _waiting) { _waiting--; Monitor.Pulse(_opQueue); } Monitor.Exit(_opQueue); }