Jitter.ThreadManager.AddTask C# (CSharp) Method

AddTask() public method

Adds a task to the ThreadManager. The task and the parameter is added to an internal list. Call Execute to execute and remove the tasks from the internal list.
public AddTask ( Action task, object param ) : void
task Action
param object
return void
        public void AddTask(Action<object> task, object param)
        {
            tasks.Add(task);
            parameters.Add(param);
        }

Usage Example

Ejemplo n.º 1
0
        private void HandleArbiter(int iterations, bool multiThreaded)
        {
            if (multiThreaded)
            {
                for (int i = 0; i < islands.Count; i++)
                {
                    if (islands[i].IsActive())
                    {
                        threadManager.AddTask(arbiterCallback, islands[i]);
                    }
                }

                threadManager.Execute();
            }
            else
            {
                for (int i = 0; i < islands.Count; i++)
                {
                    if (islands[i].IsActive())
                    {
                        arbiterCallback(islands[i]);
                    }
                }
            }
        }