c# - Performance counters and threading -


i creating custom performance counters. creating tasks on thread pool , incrementing/decrementing counters within multiple worker threads.

do need give each thread new counter object? safe share performance counter object cross-thread (for increment/decrement)

the performancecounter class uses threadsafe wrapper, internal class named sharedperformancecounter. uses interlocked.increment() increment counter value example.

there's no need lock yourself.


Comments

Popular posts from this blog

List<T>().Add problem C# -

Javascript natural sort array/object and maintain index association -