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

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -