[lldb-dev] Process's use of ReadWriteLock

Carlo Kok ck at remobjects.com
Tue Nov 20 14:25:45 PST 2012

Process uses m_run_lock as a Read/Write lock to define when it's running 
or not. However, sometimes it write-unlocks twice:

- SetPublicState (stopped/finished) calls m_run_lock.WriteUnlock()
- Process::Destroy (which gets called eventually)

Now both pthread and windows' slim read/write lock have "unspecified" 
behavior when unlocking twice, which is what I get an AV on in win7 
(64bits) but not win8. I don't know if pthread likes this on all 
platforms either (the docs I could find said it was undefined behavior). 
Does it really need to writeunlock it in destroy? If so, is there a 
check to make sure we didn't already do it?

More information about the lldb-dev mailing list