/// <summary> /// Initializes a new instance of the <see cref="CoCoL.ExecutionScope"/> class. /// </summary> /// <param name="parent">The parent scope.</param> /// <param name="threadPool">The thread pool implementation.</param> private ExecutionScope(ExecutionScope parent, IThreadPool threadPool) { if (threadPool == null) { throw new ArgumentNullException(nameof(threadPool)); } ParentScope = parent; m_threadPool = threadPool; lock (__lock) __scopes[m_instancekey] = this; Current = this; }
/// <summary> /// Static initializer to control the creation order /// </summary> static ExecutionScope() { __lock = new object(); Root = new ExecutionScope(null, ThreadPool.DEFAULT_THREADPOOL); __scopes[Root.m_instancekey] = Root; }