示例#1
0
        /// <summary>
        /// This method registers a process to be polled as part of the process loop.
        /// </summary>
        /// <typeparam name="C">The process context type.</typeparam>
        /// <param name="name">The process name.</param>
        /// <param name="ordinal">The process priority ordinal</param>
        /// <param name="process">The task manager process.</param>
        /// <param name="context">The context of type C. The default(C) if not set.</param>
        public void ProcessRegister <C>(string name, int ordinal, ITaskManagerProcess process, C context = default(C))
        {
            var holder = new TaskManagerProcessContext <C>(name)
            {
                Ordinal = ordinal, Process = process, Context = context
            };

            process.TaskSubmit       = ExecuteOrEnqueue;
            process.TaskAvailability = mAvailability;
            mProcesses.AddOrUpdate(name, holder, (n, o) => holder);
        }
示例#2
0
 /// <summary>
 /// This method registers a process to be polled as part of the process loop.
 /// </summary>
 /// <param name="name">The process name. If this is already used, then it will be replaced.</param>
 /// <param name="ordinal">The order the registered processes are polled higher is first.</param>
 /// <param name="process">The execute action.</param>
 public void ProcessRegister(string name, int ordinal, ITaskManagerProcess process)
 {
     ProcessRegister <object>(name, ordinal, process);
 }
 public TaskController(ITaskManagerProcess process)
 {
     _process = process;
 }