Exemplo n.º 1
0
        private void doWork(object objState)
        {
            if (FiddlerApplication.isClosing)
            {
                this.timerInternal.Dispose();
                return;
            }
            List <PeriodicWorker.taskItem> obj;

            Monitor.Enter(obj = this.oTaskList);
            PeriodicWorker.taskItem[] array;
            try
            {
                array = new PeriodicWorker.taskItem[this.oTaskList.Count];
                this.oTaskList.CopyTo(array);
            }
            finally
            {
                Monitor.Exit(obj);
            }
            PeriodicWorker.taskItem[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                PeriodicWorker.taskItem taskItem = array2[i];
                if (Utilities.GetTickCount() > taskItem._ulLastRun + (ulong)taskItem._iPeriod)
                {
                    taskItem._oTask();
                    taskItem._ulLastRun = Utilities.GetTickCount();
                }
            }
        }
Exemplo n.º 2
0
        internal PeriodicWorker.taskItem assignWork(SimpleEventHandler workFunction, uint iMS)
        {
            PeriodicWorker.taskItem        taskItem = new PeriodicWorker.taskItem(workFunction, iMS);
            List <PeriodicWorker.taskItem> obj;

            Monitor.Enter(obj = this.oTaskList);
            try
            {
                this.oTaskList.Add(taskItem);
            }
            finally
            {
                Monitor.Exit(obj);
            }
            return(taskItem);
        }
Exemplo n.º 3
0
        internal void revokeWork(PeriodicWorker.taskItem oToRevoke)
        {
            if (oToRevoke == null)
            {
                return;
            }
            List <PeriodicWorker.taskItem> obj;

            Monitor.Enter(obj = this.oTaskList);
            try
            {
                this.oTaskList.Remove(oToRevoke);
            }
            finally
            {
                Monitor.Exit(obj);
            }
        }