Esempio n. 1
0
            private static Int32 IncrementInbox(Int32 i, Object argument,
                                                out Boolean shouldMoveNext)
            {
                WaitAndInboxCounts waic = new WaitAndInboxCounts(i);

                // Add 1 to the inbox count
                waic.Inbox++;
                shouldMoveNext = (waic.Inbox == waic.Wait);

                // Does the inbox contain enough items to MoveNext?
                if (shouldMoveNext)
                {
                    // Subtract the number of items from the inbox
                    waic.Inbox -= waic.Wait;
                    // The next wait is indefinite
                    waic.Wait = c_MaxWait;
                }
                return(waic.ToInt32());
            }
Esempio n. 2
0
            private static Int32 SetWait(Int32 i, UInt16 numberOpsToWaitFor,
                                         out Boolean shouldMoveNext)
            {
                WaitAndInboxCounts waic = new WaitAndInboxCounts(i);

                // Set the number of items to wait for
                waic.Wait      = numberOpsToWaitFor;
                shouldMoveNext = (waic.Inbox >= waic.Wait);

                // Does the inbox contain enough items to MoveNext?
                if (shouldMoveNext)
                {
                    // Subtract the number of items from the inbox
                    waic.Inbox -= waic.Wait;
                    // The next wait is indefinite
                    waic.Wait = c_MaxWait;
                }
                return(waic.ToInt32());
            }
Esempio n. 3
0
 public AsyncEnumerator()
 {
     this.m_waitAndInboxCounts = new WaitAndInboxCounts();
     this.m_waitAndInboxCounts.Initialize();
 }