public void Shutdown()
        {
            if (logger.IsDebugEnabled)
            {
                logger.Debug(GetType().Name + " thread request shutdown");
            }
            context.RequestShutdown();

            if (beaconSenderThread != null)
            {
#if !(NETCOREAPP1_0 || NETCOREAPP1_1 || WINDOWS_UWP || NETPCL4_5)
                beaconSenderThread.Interrupt();                     // not available in .NET Core 1.0 & .NET Core 1.1
                                                                    // might cause up to 1s delay at shutdown
#endif
#if WINDOWS_UWP || NETPCL4_5
                beaconSenderThread.Wait(SHUTDOWN_TIMEOUT);
#else
                beaconSenderThread.Join(SHUTDOWN_TIMEOUT);
#endif
                if (logger.IsDebugEnabled)
                {
                    logger.Debug(GetType().Name + " thread stopped");
                }
            }
        }
Beispiel #2
0
        public void Join()
        {
            if (thread != null)
            {
#if NETFX_CORE
                thread.Wait();
#else
                thread.Join();
#endif
            }
        }
        internal override void Stop(GXDLMSServer server)
        {
            if (updater != null)
            {
                updater.Closing.Set();
                if (thread != null)
                {
#if !WINDOWS_UWP
                    thread.Join(10000);
#else
                    thread.Wait(10000);
#endif
                    thread = null;
                }
                updater = null;
            }
        }
        public void Join(int waitTimeInMillis)
        {
            lock (this)
            {
                if (thread == null)
                {
                    return;
                }
            }

#if !(NETCOREAPP1_0 || NETCOREAPP1_1 || WINDOWS_UWP || NETSTANDARD1_1)
            thread.Interrupt(); // not available in .NET Core 1.0 & .NET Core 1.1
#endif
#if WINDOWS_UWP || NETSTANDARD1_1
            thread.Wait(waitTimeInMillis);
#else
            thread.Join(waitTimeInMillis);
#endif
        }