mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 20:39:01 +00:00
33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.IO.Pipes;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading;
|
|
|
|
namespace Cosmos.Debug.Common.CDebugger
|
|
{
|
|
public class DebugConnectorPipeServer : DebugConnectorStream {
|
|
|
|
public DebugConnectorPipeServer() {
|
|
mPipe = new NamedPipeServerStream("CosmosDebug", PipeDirection.InOut, 1
|
|
, PipeTransmissionMode.Byte, PipeOptions.Asynchronous);
|
|
mPipe.BeginWaitForConnection(new AsyncCallback(DoWaitForConnection), mPipe);
|
|
}
|
|
|
|
private AutoResetEvent mWaitConnectEvent = new AutoResetEvent(false);
|
|
private NamedPipeServerStream mPipe;
|
|
|
|
public void DoWaitForConnection(IAsyncResult aResult) {
|
|
var xPipe = (NamedPipeServerStream)aResult.AsyncState;
|
|
xPipe.EndWaitForConnection(aResult);
|
|
mWaitConnectEvent.Set();
|
|
Start(mPipe);
|
|
}
|
|
|
|
public override void WaitConnect() {
|
|
mWaitConnectEvent.WaitOne();
|
|
}
|
|
}
|
|
}
|