-
Notifications
You must be signed in to change notification settings - Fork 4
JobService
Michael Lidgren edited this page Sep 12, 2020
·
2 revisions
JobService creates a number of worker threads that continually picks jobs from a queue and executes them.
JobService.Initialize();
// schedule a single job to run; returns immediately
JobService.Enqueue((x) => { Console.WriteLine("hello from job"); });
// runs action(argument) on a worker thread; returns immediately
JobService.Enqueue("name", action, argument);
// runs action(argument) on a worker thread; calls anotherAction(anotherArgument) when it is complete; returns immediately
JobService.Enqueue("name", action, argument, anotherAction, anotherArgument);
// schedule a wide job; blocks until all has completed
JobService.EnqueueWideBlock("name", action, argument);
// schedule a wide job; call 'anotherAction' when all has finished; returns immediately
JobService.EnqueueWide("name", action, argument, anotherAction, anotherArgument);
// schedule a wide job; returns immediately
JobService.EnqueueWide("name", action, argument, null, null);
// run each action in list concurrently with the argument; blocks until all has completed
JobService.ForEachActionBlock("name", actionsList, argument);
// run each action in list concurrently with the argument; when all completed call anotherAction(anotherArgument); returns immediately
JobService.ForEachAction("name", actionsList, argument, anotherAction, anotherArgument);
// schedule work to be done on each argument in list, return immediately
JobService.ForEachAction("name", actionsList, argument, null, null);
// schedule work to be done on each argument in list; blocks until all has completed
JobService.ForEachArgumentBlock("name", action, argumentsList);
// schedule work to be done on each argument in list; when all completed call anotherAction(anotherArgument); returns immediately
JobService.ForEachArgument("name", action, argumentsList, anotherAction, anotherArgument);
// schedule work to be done on each argument in list; returns immediately
JobService.ForEachArgument("name", action, argumentsList, null, null);
// shutdown to close all worker threads
JobService.Shutdown();