I am creating some custom performance counters. I will create tasks in the thread pool and increase / decrease counters from several worker threads.
Do I need to give each thread a new counter object? Is it safe to split the end-to-end flow of the performance counter object (to increase / decrease)
The PerformanceCounter class already uses a thread-safe wrapper, an inner class called SharedPerformanceCounter. It uses Interlocked.Increment () to increment a counter value, for example.
No need to block yourself.