This doesn't answer your question, but you should check this out: SE-0433 (synchronous mutual exclusion lock).