コード例 #1
0
ファイル: Engine.cs プロジェクト: aura1213/netmf-interpreter
        internal void CancelRequest( Request req )
        {
            m_requests.Remove( req );

            req.Signal( );
        }
コード例 #2
0
ファイル: Engine.cs プロジェクト: aura1213/netmf-interpreter
        private IncomingMessage[ ] SyncMessages( OutgoingMessage[ ] messages, int retries, int timeout )
        {
            int cMessage = messages.Length;
            IncomingMessage[ ] replies = new IncomingMessage[ cMessage ];
            Request[ ] requests = new Request[ cMessage ];

            for( int iMessage = 0; iMessage < cMessage; iMessage++ )
            {
                replies[ iMessage ] = SyncRequest( messages[ iMessage ], retries, timeout );
            }

            return replies;
        }
コード例 #3
0
ファイル: Engine.cs プロジェクト: aura1213/netmf-interpreter
        internal Request AsyncRequest( OutgoingMessage msg, int retries, int timeout )
        {
            Request req = new Request( this, msg, retries, timeout, null );

            lock( m_state.SyncObject )
            {

                //Checking whether IsRunning and adding the request to m_requests
                //needs to be atomic to avoid adding a request after the Engine
                //has been stopped.

                if( !IsRunning )
                {
                    throw new ApplicationException( "Engine is not running or process has exited." );
                }

                m_requests.Add( req );

                req.SendAsync( );
            }

            return req;
        }