Skip to main content

Home/ .Net Developers/ Group items tagged lock

Rss Feed Group items tagged

Tarik Guney

lock Statement (C# Reference) - 0 views

  • The lock keyword marks a statement block as a critical section by obtaining the mutual-exclusion lock for a given object, executing a statement, and then releasing the lock
  • The expression reference type in lock(expression) should not be null.
  •  
    The lock keyword ensures that one thread does not enter a critical section of code while another thread is in the critical section. If another thread tries to enter a locked code, it will wait, block, until the object is released. The section Threading (C# Programming Guide) discusses threading. The lock keyword calls Enter at the start of the block and Exit at the end of the block.
1 - 1 of 1
Showing 20 items per page