소스 검색

Save an allocation in ThreadPoolScheduler.PeriodicTimer. (#632)

Daniel C. Weber 7 년 전
부모
커밋
d00c7c5055
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      Rx.NET/Source/src/System.Reactive/Concurrency/ThreadPoolScheduler.cs

+ 2 - 2
Rx.NET/Source/src/System.Reactive/Concurrency/ThreadPoolScheduler.cs

@@ -279,10 +279,10 @@ namespace System.Reactive.Concurrency
                 // Rooting of the timer happens through the this.Tick delegate's target object,
                 // which is the current instance and has a field to store the Timer instance.
                 //
-                _timer = new System.Threading.Timer(this.Tick, null, period, period);
+                _timer = new System.Threading.Timer(@this => ((PeriodicTimer<TState>)@this).Tick(), this, period, period);
             }
 
-            private void Tick(object state)
+            private void Tick()
             {
                 _gate.Wait(
                     this,