コード例 #1
0
 /// <summary>
 /// Clears the work unit's contents.
 /// </summary>
 internal void Clear()
 {
     m_Status = AllCompleteFlag;
     m_Action = null;
     DisposeUtils.DisposeObject(ref m_Enumerator);
     AsyncFlags = 0;
     m_Nested.Clear();
     m_OnStop = null;
     m_Name   = null;
 }
コード例 #2
0
        /// <summary>
        /// Performs a step (not thread-safe).
        /// Returns if work remains.
        /// </summary>
        internal StepResult Step()
        {
            if ((m_Status & CancelledFlag) != 0)
            {
                return(StepResult.Cancelled);
            }

            long tickDelay = 0;

            if ((m_Status & ActionCompleteFlag) == 0)
            {
                m_Action();
                m_Action  = null;
                m_Status |= ActionCompleteFlag;
            }
            else if ((m_Status & EnumeratorCompleteFlag) == 0)
            {
                if (!m_Enumerator.MoveNext())
                {
                    DisposeUtils.DisposeObject(ref m_Enumerator);
                    m_Status |= EnumeratorCompleteFlag;
                }
                else
                {
                    object result = m_Enumerator.Current;
                    if (result != null)
                    {
                        if (result is AsyncSleep)
                        {
                            AsyncSleep sleep = (AsyncSleep)result;
                            tickDelay = sleep.Ticks;
                        }
                    }
                }
            }

            if (m_Status != AllCompleteFlag)
            {
                return(new StepResult(StepResultType.Incomplete, tickDelay));
            }

            return(StepResult.Complete);
        }
コード例 #3
0
 public void Dispose()
 {
     DisposeUtils.DisposeEnumerator(ref Enumerator);
 }