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

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

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