Beispiel #1
0
        /// <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;
                }
            }
        }
Beispiel #2
0
        public void SharedMemIO_Basic()
        {
            SharedMemOutbox outBox;

            ready   = false;
            recvMsg = null;
            thread  = new Thread(new ThreadStart(BasicThreadFunc));
            thread.Start();

            while (!ready)
            {
                Thread.Sleep(100);
            }

            outBox = new SharedMemOutbox(100, TimeSpan.FromSeconds(10));
            outBox.Send("BasicIn", Encoding.UTF8.GetBytes("Hello World!"));
            outBox.Close();

            thread.Join();

            Assert.AreEqual("Hello World!", recvMsg);
        }
Beispiel #3
0
        /// <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;
            }
        }