Exemplo n.º 1
0
        /// <summary>
        /// Initializes the shutdown signaling with optional connection to a global shutdown signaling object.
        /// </summary>
        /// <param name="GlobalShutdown">
        /// Global shutdown signaling object that the newly created shutdown signaling object will be connected to.
        /// This can be null if we are initializing the global shutdown object that exists on itself.
        /// </param>
        public ComponentShutdown(ComponentShutdown GlobalShutdown)
        {
            if (GlobalShutdown == null)
            {
                return;
            }

            registration = ThreadPool.RegisterWaitForSingleObject(GlobalShutdown.ShutdownEvent, WaitOrTimerCallback, this, Timeout.InfiniteTimeSpan, true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Callback routine that is called once the global shutdown event is set.
        /// </summary>
        /// <param name="state">Component shutdown instance.</param>
        /// <param name="TimedOut">Not used.</param>
        private static void WaitOrTimerCallback(object state, bool TimedOut)
        {
            log.Trace("()");

            ComponentShutdown cs = (ComponentShutdown)state;

            cs.registration.Unregister(null);

            log.Trace("(-)");
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a component and connects its shutdown signaling to the global shutdown.
 /// </summary>
 public Component()
 {
     ShutdownSignaling = new ComponentShutdown(Base.Components.GlobalShutdown);
 }