示例#1
0
文件: ThreadPool.cs 项目: zmyer/ice
        public void finish(EventHandler handler)
        {
            lock (this)
            {
                Debug.Assert(!_destroyed);

                handler._registered = SocketOperation.None;

                //
                // If there are no pending asynchronous operations, we can call finish on the handler now.
                //
                if (handler._pending == 0)
                {
                    executeNonBlocking(() =>
                    {
                        ThreadPoolCurrent current = new ThreadPoolCurrent(this, handler, SocketOperation.None);
                        handler.finished(ref current);
                    });
                }
                else
                {
                    handler._finish = true;
                }
            }
        }
示例#2
0
 public void finish(EventHandler handler)
 {
     _m.Lock();
     try
     {
         Debug.Assert(!_destroyed);
         if (handler._pending == 0)
         {
             handler._registered = SocketOperation.None;
             executeNonBlocking(delegate()
             {
                 ThreadPoolCurrent current =
                     new ThreadPoolCurrent(this, handler, SocketOperation.None);
                 handler.finished(ref current);
             });
         }
         else
         {
             handler._finish = true;
         }
     }
     finally
     {
         _m.Unlock();
     }
 }
示例#3
0
        public void finish(EventHandler handler)
        {
            lock(this)
            {
                Debug.Assert(!_destroyed);

                //
                // If there are no pending asynchronous operations, we can call finish on the handler now.
                //
                if(handler._pending == 0)
                {
                    handler._registered = SocketOperation.None;
                    executeNonBlocking(() =>
                       {
                           ThreadPoolCurrent current = new ThreadPoolCurrent(this, handler, SocketOperation.None);
                           handler.finished(ref current);
                       });
                }
                else
                {
                    handler._finish = true;
                }
            }
        }
示例#4
0
 public void finish(EventHandler handler)
 {
     _m.Lock();
     try
     {
         Debug.Assert(!_destroyed);
         if(handler._pending == 0)
         {
             handler._registered = SocketOperation.None;
             executeNonBlocking(delegate()
                                {
                                    ThreadPoolCurrent current = 
                                        new ThreadPoolCurrent(this, handler, SocketOperation.None);
                                    handler.finished(ref current);
                                });
         }
         else
         {
             handler._finish = true;
         }
     }
     finally
     {
         _m.Unlock();
     }
 }