Example #1
0
        public IWorkItemResult QueueWorkItem(XUtils.Threading.Base.Action action)
        {
            this.PreQueueWorkItem();
            WorkItem workItem = WorkItemFactory.CreateWorkItem(this, this.WIGStartInfo, delegate
            {
                action();
                return(null);
            });

            this.Enqueue(workItem);
            return(workItem.GetWorkItemResult());
        }
Example #2
0
        public IWorkItemResult QueueWorkItem <T1, T2>(XUtils.Threading.Base.Action <T1, T2> action, T1 arg1, T2 arg2)
        {
            this.PreQueueWorkItem();
            WorkItem workItem = WorkItemFactory.CreateWorkItem(this, this.WIGStartInfo, delegate(object state)
            {
                action(arg1, arg2);
                return(null);
            }, this.WIGStartInfo.FillStateWithArgs ? new object[]
            {
                arg1,
                arg2
            } : null);

            this.Enqueue(workItem);
            return(workItem.GetWorkItemResult());
        }