public void Run()
 {
     OnRun();
     lock (pool) {
         pool.ReturnObject((T)this);
     }
 }
    public void Wait(Mutex mutex)
    {
        LinkedListNode <ManualResetEvent> ev;

        lock (eventPool) {
            ev = eventPool.GetObject();
            waitQueue.AddLast(ev);
            mutex.ReleaseMutex();
        }
        ev.Value.WaitOne();
        ev.Value.Reset();
        lock (eventPool) {
            eventPool.ReturnObject(ev);
        }
        mutex.WaitOne();
    }
 public void ReturnObject(GameObject obj)
 {
     pool.ReturnObject(obj);
 }
Beispiel #4
0
 public void Run()
 {
     OnRun();
     _pool.ReturnObject((T)this);
 }