How scalable is System.Threading.Timer?

前端 未结 4 1074
后悔当初
后悔当初 2020-12-09 03:12

I\'m writing an app that will need to make use of Timers, but potentially very many of them. How scalable is the System.Threading.Timer class? Th

4条回答
  •  生来不讨喜
    2020-12-09 03:44

    Consolidate them. Create a timer service and ask that for the timers. It will only need to keep 1 active timer (for the next due call)...

    For this to be an improvement over just creating lots of Threading.Timer objects, you have to assume that it isn't exactly what Threading.Timer is already doing internally. I'd be interested to know how you came to that conclusion (I haven't disassembled the native bits of the framework, so you could well be right).

提交回复
热议问题