コード例 #1
0
ファイル: FromEvent.cs プロジェクト: shekky/reactive
            private void Initialize()
            {
                /*
                 * CALLERS - Ensure this is called under the lock!
                 *
                 * lock (_parent._gate) */
                {
                    //
                    // When the ref count goes to zero, no-one should be able to perform operations on
                    // the session object anymore, because it gets nulled out.
                    //
                    Debug.Assert(_removeHandler == null);
                    _removeHandler = new SingleAssignmentDisposable();

                    //
                    // Conversion code is supposed to be a pure function and shouldn't be run on the
                    // scheduler, but the add handler call should. Notice the scheduler can be the
                    // ImmediateScheduler, causing synchronous invocation. This is the default when
                    // no SynchronizationContext is found (see QueryLanguage.Events.cs and search for
                    // the GetSchedulerForCurrentContext method).
                    //
                    var onNext = _parent.GetHandler(_subject.OnNext);
                    _parent._scheduler.Schedule(onNext, AddHandler);
                }
            }
コード例 #2
0
 private void Initialize()
 {
     /*
      * CALLERS - Ensure this is called under the lock!
      *
      * lock (_parent._gate) */
     {
         //
         // Conversion code is supposed to be a pure function and shouldn't be run on the
         // scheduler, but the add handler call should. Notice the scheduler can be the
         // ImmediateScheduler, causing synchronous invocation. This is the default when
         // no SynchronizationContext is found (see QueryLanguage.Events.cs and search for
         // the GetSchedulerForCurrentContext method).
         //
         var onNext = _parent.GetHandler(_subject.OnNext);
         _parent._scheduler.ScheduleAction(onNext, AddHandler);
     }
 }