// do the final cleanup when the Dispatcher or AppDomain is shut down private void OnShutDown() { _viewManager = null; _commitManager = null; _valueConverterTable = null; _mostRecentTask = null; _head = _tail = null; _crossThreadQueue.Clear(); // notify all the async dispatchers we've ever talked to // The InterlockedExchange makes sure we only do this once // (in case Dispatcher and AppDomain are being shut down simultaneously // on two different threads) HybridDictionary asyncDispatchers = (HybridDictionary)Interlocked.Exchange(ref _asyncDispatchers, null); if (asyncDispatchers != null) { foreach (object o in asyncDispatchers.Keys) { IAsyncDataDispatcher dispatcher = o as IAsyncDataDispatcher; if (dispatcher != null) { dispatcher.CancelAllRequests(); } } } _defaultAsyncDataDispatcher = null; // Note: the engine is still held in TLS. This maintains the 1-1 relationship // between the thread and the engine. However the engine is basically // dead - _mostRecentTask is null, and most operations are now no-ops or illegal. // This imitates the behavior of the thread's Dispatcher. }
// Token: 0x060074C3 RID: 29891 RVA: 0x002166D0 File Offset: 0x002148D0 private void OnShutDown() { this._viewManager = null; this._commitManager = null; this._valueConverterTable = null; this._mostRecentTask = null; this._head = (this._tail = null); this._crossThreadQueue.Clear(); HybridDictionary hybridDictionary = Interlocked.Exchange <HybridDictionary>(ref this._asyncDispatchers, null); if (hybridDictionary != null) { foreach (object obj in hybridDictionary.Keys) { IAsyncDataDispatcher asyncDataDispatcher = obj as IAsyncDataDispatcher; if (asyncDataDispatcher != null) { asyncDataDispatcher.CancelAllRequests(); } } } this._defaultAsyncDataDispatcher = null; }