2009年1月7日星期三

About the doubt of synchronism of multi-line Cheng Monitor

About the doubt of Monitor:
If say Monitor.Enter method: In appoint his lock is gotten on the object.
And Monitor.Exit method: Release his lock that appoints an object to go up.
And once get (called Monitor.Enter) specify a target (code paragraph) lock, other line Cheng cannot get this lock.

Narrate according to above place, a code paragraph can be carried out only by Cheng of a line, cannot get below the case that next line Cheng did not end to was not released in this line Cheng should be locked up and implement code paragraph, so is the meaning of multi-line Cheng in?
Is the action of multi-line Cheng by many lines Cheng implements this paragraph of code at the same time thereby faster improve efficiency? Major code should be OK intercurrent carry out, the visit of a few resource needs synchronous visit.

Not be all code can erupt simultaneously carry out. Line Cheng- - use Lock and Interlocked and Monitor respectively kind the critical area that realizes line Cheng is operated (mutually exclusive) (give typical examples downloads)
Http://blog.csdn.net/chengking/archive/2005/11/30/540644.aspx

Master line Cheng:
Http://blog.csdn.net/ChengKing/category/160892.aspx

没有评论: