Esempio n. 1
0
        public static IEnumerator TestThing(Channel c)
        {
            //does not block and continues directly
            yield return c.ListenForInput(p => {
                Console.WriteLine("non blocking: " + p.ToString());
            });

            yield return c.WaitForChannelChange();
            Console.WriteLine("change");
            yield return c.WaitForChannelChange();
            Console.WriteLine("channel changed again");

            object o = null;
            //blocks and waits for input
            yield return c.WaitForInput((p) => {
                o = p;
            });

            Console.WriteLine("second blocking: " + o);

            while (c.length > 0)
            {
                Console.WriteLine("#" + c.Pull());
            }

            yield break;
        }