Beispiel #1
0
        protected internal override void QueueTask(Task task)
        {
#if !FEATURE_PAL && !FEATURE_CORECLR    // PAL and CoreClr don't support  eventing
            var etwLog = TplEtwProvider.Log;
            if (etwLog.IsEnabled(EventLevel.Verbose, ((EventKeywords)(-1))))
            {
                Task currentTask  = Task.InternalCurrent;
                Task creatingTask = task.m_parent;

                etwLog.TaskScheduled(this.Id, currentTask == null ? 0 : currentTask.Id,
                                     task.Id, creatingTask == null ? 0 : creatingTask.Id,
                                     (int)task.Options);
            }
#endif

            if ((task.Options & TaskCreationOptions.LongRunning) != 0)
            {
                NativeThreadPool.QueueLongRunningWork(() => task.ExecuteEntry(false));
            }
            else
            {
                // Normal handling for non-LongRunning tasks.
                bool forceToGlobalQueue = ((task.Options & TaskCreationOptions.PreferFairness) != 0);
                ThreadPool.UnsafeQueueCustomWorkItem(task, forceToGlobalQueue);
            }
        }
Beispiel #2
0
        private void buttonChangeReplaceTaskManager_Click(object sender, EventArgs e)
        {
            this.SaveSettings();
            if (!_dontApply)
            {
                this.ApplySettings();
            }
            buttonApply.Enabled = false;

            string args = "-o -hwnd " + this.Handle.ToString() +
                          " -rect " + this.Location.X.ToString() + "," + this.Location.Y.ToString() + "," +
                          this.Size.Width.ToString() + "," + this.Size.Height.ToString();

            NativeThreadPool.QueueWorkItem(thisHandle =>
            {
                Program.StartProcessHackerAdminWait(args, (IntPtr)thisHandle, 0xffffffff);

                this.BeginInvoke(new MethodInvoker(() =>
                {
                    Settings.Instance.Reload();
                    this.LoadSettings();

                    if (!_dontApply)
                    {
                        this.ApplySettings();
                    }

                    buttonApply.Enabled = false;
                    buttonOK.Select();
                }));
            }, this.Handle);
        }