Example #1
0
        private void TimeSeparatedTask(IExecutive exec, object userData)
        {
            IDetachableEventController dec = exec.CurrentEventController;

            Debug.WriteLine(exec.Now + " : " + userData.ToString() + " performing initialization of detachable task on thread " + System.Threading.Thread.CurrentThread.GetHashCode());

            while (m_random.Next(3) < 2)
            {
                DateTime when = exec.Now + TimeSpan.FromDays(1.5);

                Debug.WriteLine("Suspending task until " + when);

                dec.SuspendUntil(when);

                Debug.WriteLine(exec.Now + " : " + userData.ToString() + " performing continuation of detachable task on thread " + System.Threading.Thread.CurrentThread.GetHashCode());
            }
        }