예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CoCoL.SingleThreadedWorker"/> class.
 /// </summary>
 public SingleThreadedWorker()
 {
     AutomationExtensions.AutoWireChannels(this, null);
     m_channel      = ChannelManager.CreateChannel <Func <Task> >();
     m_workerSource = new CancellationTokenSource();
     m_worker       = AutomationExtensions.RunProtected(this, Start);
 }
예제 #2
0
        /// <summary>
        /// Runs the process as a one-shot.
        /// </summary>
        /// <returns>The task.</returns>
        protected Task SingleRun()
        {
            if (m_started != null)
            {
                return(m_started);
            }

            lock (m_lock)
            {
                if (m_started == null)
                {
                    m_started = AutomationExtensions.RunProtected(this, Start);
                }
            }

            return(m_started);
        }