예제 #1
0
        /// <summary>
        /// Closes the Apns Connections without waiting for Queued Notifications to be sent.  This will cause QueueNotification to always return false after this method is called.
        /// </summary>
        public void Dispose()
        {
            accepting = false;

            //We don't really care about the race condition here
            // since disposing does NOT wait for all notifications to be sent

            disposing = true;

            //Wait for the worker to finish cleanly
            if (workerThread != null && workerThread.IsAlive)
            {
                workerThread.Join();
            }

            try { apnsChannel.Dispose(); }
            catch { }
        }