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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top