public bool IsOnlyInstance() { bool isOnlyInstance; _mutex = new Mutex(true, _pipeName.ToString(), out isOnlyInstance); return(isOnlyInstance); }
public void TearDown() { if (Platform.OperatingSystem != OS.Mac) { return; } File.Delete(Path.Combine(UnixSocketStream.SocketDirectory, _pipeName.ToString())); }
/// <summary> /// Connects to the named pipe /// </summary> /// <returns>Whether connection was successful</returns> public bool Connect() { Client = new NamedPipeClientStream(PipeName.ToString()); var tries = 0; while (Client.IsConnected == false) { if (tries == 20) { break; // Failed to connect } Client.Connect(); tries += 1; Thread.Sleep(1000); } return(Client.IsConnected); }