Open
Description
Type of issue
Code doesn't work
Description
++invokeCount in example must called under lock or interlocked because:
"The callback method executed by the timer should be reentrant, because it is called on ThreadPool threads. The callback can be executed simultaneously on two thread pool threads if the timer interval is less than the time required to execute the callback, or if all thread pool threads are in use and the callback is queued multiple times."
Page URL
https://learn.microsoft.com/en-us/dotnet/api/system.threading.timer?view=net-9.0
Content source URL
https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.Threading/Timer.xml
Document Version Independent Id
987f743c-c849-522e-b662-e520c1efaed1