protected override void Reprioritize(DispatcherOperation op, DispatcherPriority oldpriority) { int oldp = (int)oldpriority; PokableQueue q = this.priorityQueues[oldp]; lock (q) { q.Remove(op); } this.Queue(op.Priority, op); }
internal void Reprioritize(DispatcherOperation op, DispatcherPriority oldpriority) { int oldp = (int)oldpriority; PokableQueue q = this.priorityQueues[oldp]; lock (q) { q.Remove(op); } this.Queue(op.Priority, op); this.hooks.EmitOperationPriorityChanged(op); }
private void Queue(DispatcherPriority priority, DispatcherOperation x) { int p = (int)priority; PokableQueue q = this.priorityQueues[p]; lock (q) { int flag = 1 << p; q.Enqueue(x); this.queueBits |= flag; } this.hooks.EmitOperationPosted(x); if (Thread.CurrentThread != this.baseThread) { PlatformInterface.Instance.Dispatcher.SendMessage(); } }
private void Queue(DispatcherPriority priority, DispatcherOperation x) { int p = (int)priority; PokableQueue q = this.priorityQueues[p]; lock (q) { int flag = 1 << p; q.Enqueue(x); this.queueBits |= flag; } if (Thread.CurrentThread != this.baseThread) { UnmanagedMethods.PostMessage( IntPtr.Zero, (int)UnmanagedMethods.WindowsMessage.WM_DISPATCH_WORK_ITEM, IntPtr.Zero, IntPtr.Zero); } }
private void RunFrame(DispatcherFrame frame) { do { while (this.queueBits != 0) { for (int i = TopPriority; i > 0 && this.queueBits != 0; i--) { int currentBit = this.queueBits & (1 << i); if (currentBit != 0) { PokableQueue q = this.priorityQueues[i]; do { DispatcherOperation task; lock (q) { task = (DispatcherOperation)q.Dequeue(); } task.Invoke(); if (task.Status == DispatcherOperationStatus.Aborted) { this.hooks.EmitOperationAborted(task); } else { this.hooks.EmitOperationCompleted(task); } if (!frame.Continue) { return; } if (this.HasShutdownStarted) { this.PerformShutdown(); return; } lock (q) { if (q.Count == 0) { this.queueBits &= ~(1 << i); break; } } if (currentBit < (this.queueBits & ~currentBit)) { break; } }while (true); } } } this.hooks.EmitInactive(); PlatformInterface.Instance.Dispatcher.ProcessMessage(); if (this.HasShutdownStarted) { this.PerformShutdown(); return; } }while (frame.Continue); }
protected override void RunFrame(DispatcherFrame frame) { do { while (this.queueBits != 0) { for (int i = TopPriority; i > 0 && this.queueBits != 0; i--) { int currentBit = this.queueBits & (1 << i); if (currentBit != 0) { PokableQueue q = this.priorityQueues[i]; do { DispatcherOperation task; lock (q) { task = (DispatcherOperation)q.Dequeue(); } task.Invoke(); if (!frame.Continue) { return; } if (this.HasShutdownStarted) { this.PerformShutdown(); return; } lock (q) { if (q.Count == 0) { this.queueBits &= ~(1 << i); break; } } if (currentBit < (this.queueBits & ~currentBit)) { break; } }while (true); } } } UnmanagedMethods.MSG msg; UnmanagedMethods.GetMessage(out msg, IntPtr.Zero, 0, 0); UnmanagedMethods.TranslateMessage(ref msg); UnmanagedMethods.DispatchMessage(ref msg); if (this.HasShutdownStarted) { this.PerformShutdown(); return; } }while (frame.Continue); }