Mono.MicroThreads.MicroThread.Wait C# (CSharp) Méthode

Wait() public méthode

public Wait ( ) : void
Résultat void
        public void Wait()
        {
            if (m_state != MicroThreadState.Running)
            {
                throw new Exception(String.Format("Illegal thread state in Wait(): {0}", m_state));
            }

            #if EXTRA_CHECKS
            if (CurrentThread != this)
            {
                throw new Exception("Trying to yield a non-current thread");
            }
            #endif

            Scheduler.Wait();
        }

Usage Example

        public int Send(byte[] buffer, int offset, int size, SocketFlags socketFlags, out SocketError error)
        {
            int sent = 0;

            while (true)
            {
                sent += m_socket.Send(buffer, offset + sent, size - sent, socketFlags, out error);

                if (error == SocketError.WouldBlock)
                {
                    error = SocketError.Success;
                }

                if (error != SocketError.Success)
                {
                    return(sent);
                }

                if (sent < size)
                {
                    m_writeCS.Enter();
                    m_writingThread = MicroThread.CurrentThread;
                    m_writingThread.Wait();
                    m_writingThread = null;
                    m_writeCS.Exit();
                }
                else
                {
                    return(sent);
                }
            }
        }
All Usage Examples Of Mono.MicroThreads.MicroThread::Wait