/// <summary> Stops listening to incoming events on the channel </summary> public void StopListening(int timeout) { IpcEventListener kill; lock (_sync) { kill = _listener; _listener = null; } if (kill != null) { kill.StopListening(timeout); kill.Dispose(); } }
//static ConcurrentBag<string> _instanceNames = new ConcurrentBag<string>() { }; /// <summary> Same as StartListening but specifies a name that can be used to lookup this instance </summary> public void StartListening(string instanceName) { if (_listener != null) { return; } lock (_sync) { try { //[???????????????????????????????????????????????!!!!!!!!!!!!!!!!!!!!!!!!!!!!!] Check.Assert <InvalidOperationException>(_listener == null, "The channel is already listening."); _listener = new IpcEventListener(this, _instanceId, instanceName); } catch (Exception ex) { string m = ex.Message; } } }