Ejemplo 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);
        }
Ejemplo 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("(-)");
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes the component and connects its shutdown signaling to the global shutdown.
 /// </summary>
 /// <param name="Name">Name of the component.</param>
 public Component(string Name)
 {
     InternalComponentName = Name;
     ShutdownSignaling     = new ComponentShutdown(Base.ComponentManager.GlobalShutdown);
 }