/// <summary> /// Releases and resources associated with the ServiceControl /// infrastructure. /// </summary> /// <remarks> /// This must be called when the derived class is stopped. /// </remarks> public void Close() { using (TimedLock.Lock(this)) { if (inbox != null) { inbox.Close(); inbox = null; } if (outbox != null) { outbox.Close(); outbox = null; } } }
private void BasicThreadFunc() { SharedMemInbox inBox; DateTime start; inBox = new SharedMemInbox(); inBox.Open("BasicIn", 100, new SharedMemInboxReceiveDelegate(OnReceive)); ready = true; start = DateTime.UtcNow; while (recvMsg == null) { if (DateTime.UtcNow - start >= TimeSpan.FromSeconds(5)) { break; } Thread.Sleep(100); } inBox.Close(); }
/// <summary> /// Releases any resources associated with the service control instance. /// </summary> public void Close() { id = Guid.Empty; isOpen = false; services = null; if (inbox != null) { inbox.Close(); inbox = null; } if (outbox != null) { outbox.Close(); outbox = null; } if (onReply != null) { onReply.Close(); onReply = null; } }