// 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. }
// make an async request to the scheduler that handles requests for the given target internal void AddAsyncRequest(DependencyObject target, AsyncDataRequest request) { if (target == null) { return; } // get the appropriate scheduler IAsyncDataDispatcher asyncDispatcher = AsyncDataDispatcher; /* AsyncDataDispatcher property is cut (task 41079) * IAsyncDataDispatcher asyncDispatcher = Binding.GetAsyncDataDispatcher(target); * if (asyncDispatcher == null) * { * asyncDispatcher = AsyncDataDispatcher; * } */ // add it to the list of schedulers that need cleanup if (_asyncDispatchers == null) { _asyncDispatchers = new HybridDictionary(1); // lazy instantiation } _asyncDispatchers[asyncDispatcher] = null; // the value is unused // make the request asyncDispatcher.AddRequest(request); }
// Token: 0x060074B7 RID: 29879 RVA: 0x00216334 File Offset: 0x00214534 internal void AddAsyncRequest(DependencyObject target, AsyncDataRequest request) { if (target == null) { return; } IAsyncDataDispatcher asyncDataDispatcher = this.AsyncDataDispatcher; if (this._asyncDispatchers == null) { this._asyncDispatchers = new HybridDictionary(1); } this._asyncDispatchers[asyncDataDispatcher] = null; asyncDataDispatcher.AddRequest(request); }
// 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; }