Example #1
0
        private static void fibgen(channel <long> ch)
        {
            for (long x = 0L; x < 10L; x++)
            {
                ch.Send(fib(x));
            }

            close(ch);
        }
Example #2
0
            public ChannelTimer(long ticks, bool continuous)
            {
                m_notify = make_channel <Time>();
                m_delay  = (int)(ticks / TimeSpan.TicksPerMillisecond);

                m_pulse = () =>
                {
                    m_notify.Send(Now());

                    if (continuous)
                    {
                        m_pulse?.DelayAndExecute(m_delay);
                    }
                };
            }