DotNetWorkQueue.SchedulerContainer.CreateTaskFactoryInternal C# (CSharp) Method

CreateTaskFactoryInternal() private method

Creates the task factory.
private CreateTaskFactoryInternal ( ATaskScheduler scheduler, bool weOwnScheduler ) : ITaskFactory
scheduler ATaskScheduler The scheduler.
weOwnScheduler bool if set to true [we own scheduler].
return ITaskFactory
        private ITaskFactory CreateTaskFactoryInternal(ATaskScheduler scheduler, bool weOwnScheduler)
        {
            if (weOwnScheduler)
            {
                var container = _createContainerInternal().Create(QueueContexts.TaskFactory, _registerService, _transportInit,
                 serviceRegister => serviceRegister.Register(() => scheduler, LifeStyles.Singleton), _setOptions);
                Containers.Add(container);
                return container.GetInstance<ITaskFactory>();

            }
            else
            {
                var container = _createContainerInternal().Create(QueueContexts.TaskFactory, _registerService, _transportInit,
                    serviceRegister => serviceRegister.RegisterNonScopedSingleton(scheduler), _setOptions);
                Containers.Add(container);
                return container.GetInstance<ITaskFactory>();
            }
        }