Issue 3000: Move AutoUnlock into conditional_variable_win
http://code.google.com/p/chromium/issues/detail?id=3000

Comment #1 by jim.roskind:
I'm not sure what the phrase "incorrect on Posix" means.... but we can  
simplify
AutoUnlock().

There are two reasons (historically) for its existence:

a) It is a helper object.  It it analogous to AutoLock(), and assures that  
when the
scope is exited, that the corresponding state change is "undone." In this  
case, it
does the unlocking on construction, and a matching amount of locking on  
destruction.

b) Windows supported nested locks, and our Lock() class (up until recently)  
also
supported this nesting of Acquire() calls.  As a result, doing  
a "guaranteed release"
requires a bit of looping, as well corresponding looping to restore the  
lock state.

As we agree to not use nested locks (I'm hoping to land a DCHECK() RSN),  
looping is
not needed, and it is not necessary to to have private methods (of the Lock  
class)
achieve this feat (it will not be necessary to check for nesting depth).   
Simply put,
the AutoUnlock() could be relocated to the ConditionVarible class as we  
assert that
locks will not be nested.   Condition variables can then be more natively
implemented, and this function would not be a part of the port.

I can add this to my CL which lands the DCHECK() on nested loops.

If you can get information about the "incorrect on Posix" comment, that  
would be
helpful.  The code should (currently) work quite well (and port just fine)  
when locks
are not nested, but it would possibly bother a programmer familiar with  
Posix locks
to realize that nested locks were contemplated.



-- 
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Chromium-bugs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/chromium-bugs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to