示例#1
0
        public virtual IEnumerator <TSource> GetEnumerator <TSource>(IObservable <TSource> source)
        {
#if !NO_PERF && !NO_CDS
            var e = new GetEnumerator <TSource>();
            return(e.Run(source));
#else
            var q = new Queue <Notification <TSource> >();
            var s = new Semaphore(0, int.MaxValue);
            return(PushToPull(
                       source,
                       x =>
            {
                lock (q)
                    q.Enqueue(x);
                s.Release();
            },
                       () =>
            {
                s.WaitOne();
                lock (q)
                    return q.Dequeue();
            }));
#endif
        }
        public virtual IEnumerator <TSource> GetEnumerator <TSource>(IObservable <TSource> source)
        {
            var e = new GetEnumerator <TSource>();

            return(e.Run(source));
        }