public IWorkItemResult QueueWorkItem(Action action)
        {
            PreQueueWorkItem();
            WorkItem workItem = WorkItemFactory.CreateWorkItem(
                this,
                WIGStartInfo,
                delegate
            {
                action.Invoke();
                return(null);
            });

            Enqueue(workItem);
            return(workItem.GetWorkItemResult());
        }
        public IWorkItemResult <TResult> QueueWorkItem <T1, T2, T3, T4, TResult>(
            Func <T1, T2, T3, T4, TResult> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
        {
            PreQueueWorkItem();
            WorkItem workItem = WorkItemFactory.CreateWorkItem(
                this,
                WIGStartInfo,
                state =>
            {
                return(func.Invoke(arg1, arg2, arg3, arg4));
            },
                WIGStartInfo.FillStateWithArgs ? new object[] { arg1, arg2, arg3, arg4 } : null);

            Enqueue(workItem);
            return(new WorkItemResultTWrapper <TResult>(workItem.GetWorkItemResult()));
        }
        public IWorkItemResult QueueWorkItem <T1, T2, T3>(Action <T1, T2, T3> action, T1 arg1, T2 arg2, T3 arg3, WorkItemPriority priority)
        {
            PreQueueWorkItem();
            WorkItem workItem = WorkItemFactory.CreateWorkItem(
                this,
                WIGStartInfo,
                state =>
            {
                action.Invoke(arg1, arg2, arg3);
                return(null);
            },
                WIGStartInfo.FillStateWithArgs ? new object[] { arg1, arg2, arg3 } : null, priority);

            Enqueue(workItem);
            return(workItem.GetWorkItemResult());
        }
Ejemplo n.º 4
0
        public IWorkItemResult <TResult> QueueWorkItem <T1, T2, TResult>(Func <T1, T2, TResult> func, T1 arg1, T2 arg2, WorkItemPriority priority = SmartThreadPool.DefaultWorkItemPriority)
        {
            PreQueueWorkItem();
            WorkItem workItem = WorkItemFactory.CreateWorkItem(
                this,
                WIGStartInfo,
                state =>
            {
                return(func.Invoke(arg1, arg2));
            },
                WIGStartInfo.FillStateWithArgs ? new object[] { arg1, arg2 } : null,
                priority);

            Enqueue(workItem);
            return(new WorkItemResultTWrapper <TResult>(workItem.GetWorkItemResult()));
        }
Ejemplo n.º 5
0
        public IWorkItemResult QueueWorkItem <T>(Action <T> action, T arg, WorkItemPriority priority = SmartThreadPool.DefaultWorkItemPriority)
        {
            PreQueueWorkItem();
            WorkItem workItem = WorkItemFactory.CreateWorkItem(
                this,
                WIGStartInfo,
                state =>
            {
                action.Invoke(arg);
                return(null);
            },
                WIGStartInfo.FillStateWithArgs ? new object[] { arg } : null, priority);

            Enqueue(workItem);
            return(workItem.GetWorkItemResult());
        }
Ejemplo n.º 6
0
        public IWorkItemResult <TResult> QueueWorkItem <T, TResult>(Func <T, TResult> func, T arg, WorkItemPriority priority = WorkItemPriority.Normal)
        {
            PreQueueWorkItem();
            WorkItem workItem = WorkItemFactory.CreateWorkItem(
                this,
                WIGStartInfo,
                state =>
            {
                return(func.Invoke(arg));
            },
                WIGStartInfo.FillStateWithArgs ? new object[] { arg } : null,
                priority);

            Enqueue(workItem);
            return(new WorkItemResultTWrapper <TResult>(workItem.GetWorkItemResult()));
        }
        public IWorkItemResult QueueWorkItem <T1, T2>(Action <T1, T2> action, T1 arg1, T2 arg2)
        {
            PreQueueWorkItem();
            WorkItem workItem = WorkItemFactory.CreateWorkItem(
                this,
                WIGStartInfo,
                delegate
            {
                action.Invoke(arg1, arg2);
                return(null);
            },
                WIGStartInfo.FillStateWithArgs ? new object[] { arg1, arg2 } : null);

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