Multithreading: Which lock object should i use?(www.mbaldinger.com)

submitted by baldibaldi(508) 1 year, 8 months ago

The lock keyword locks a specified code block so two threads can't process the same code block at the same time. When one threads exits the locked block, another thread can enter the locked code block. The Monitor class offers the same functionality, but you specifiy the start and end of the locked code block with Monitor.Enter and Monitor.Exit. For both techniques you need a variable to lock on, but what sort of variable should you use?

add a comment |category: |Views: 3

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

No comments so far

information Login or create an account to comment on this story