Пример #1
0
 /// <summary>
 /// Adds a new task to await before startup is completed.
 /// </summary>
 public void AddTask(string taskName, string description, Func <Task> task)
 {
     lock (_workingTasks)
     {
         var startupTask = new StartupTask(_logger, taskName, description, task);
         _workingTasks.Add(startupTask);
     }
 }
Пример #2
0
        /// <summary>
        /// Adds a new task to await before startup is completed.
        /// </summary>
        public StartupTask RegisterStartupTask(string taskName, string description, Func <Task> task)
        {
            lock (_lockObject)
            {
                var startupTask = new StartupTask(_logger, this, taskName, description, task);
                _workingTasks.Add(startupTask);

                _startupCompleted = Task.WhenAll(_startupCompleted, startupTask.Task);
                return(startupTask);
            }
        }