SyncLock Help

  • Thread starter Thread starter Larry Lowry
  • Start date Start date
L

Larry Lowry

I have two or more threads running. I want each of
them to update a simple counter (Dim cnt as Long).

I know I can use Synclock to lock access to an object
but what is the syntax to lock a simple variable?
It should be easy and obvious but I'm missing it.

TIA

Larry Lowry
 
I have two or more threads running. I want each of
them to update a simple counter (Dim cnt as Long).

I know I can use Synclock to lock access to an object
but what is the syntax to lock a simple variable?
It should be easy and obvious but I'm missing it.

TIA

Larry Lowry

You might want to look at the System.Threading.Interlock class...
 
Back
Top