How expensive is the lock statement?

后端 未结 7 803
面向向阳花
面向向阳花 2020-11-28 07:00

I\'ve been experimenting with multi threading and parallel processing and I needed a counter to do some basic counting and statistic analysis of the speed of the processing.

相关标签:
7条回答
  • 2020-11-28 07:35

    This doesn't answer your query about performance, but I can say that the .NET Framework does offer an Interlocked.Add method that will allow you to add your amount to your done member without manually locking on another object.

    0 讨论(0)
提交回复
热议问题