Repository navigation
Made the rcts thread safe - #3251
Conversation
roji
left a comment
There was a problem hiding this comment.
What do you think about this perf-wise? It looks OK to me - this is a lock with very little contention. But wanting to make sure.
But any reason to not just write the new CTS to _cts (which is volatile) and then dispose the older one? That would simply remove the lock altogether.
You together with @YohDeadfall definitely know much more about performance then me 😄
|
roji
left a comment
There was a problem hiding this comment.
CancelAfter isn't threadsafe (and so is Dispose).
Good point.
In any case, on the Start/Reset side the lock is only taken if the CTS expired (rare), and the Cancel/CancelAfter is only done when a cancellation is actually requested. So nothing here is on any hot path as far as I can tell.
Closes #3250