[PATCH] Teach pthread checker about double unlocks

Jordan Rose jordan_rose at apple.com
Wed Mar 19 10:20:19 PDT 2014


Hi, Daniel. I'm wondering why we need a Locked state at all. We still want to support an unbalanced unlock, and if we want to handle recursive locks (PR10418) we'd have to do more work anyway than just "locked" or "unlocked". (The existence of recursive locks means that a double-unlock warning isn't always correct.)

I didn't look at the patch too closely, but it mostly looks sensible. What do you think about this, though?
Jordan


On Mar 13, 2014, at 16:32 , Daniel Fahlgren <daniel at fahlgren.se> wrote:

> Hi Jordan,
> 
> This patch makes the pthread checker detect double unlocks. I have
> copied the idea with a map from the stream checker, not sure if that is
> the best approach?
> 
> Tracking the state will later make it possible to warn if you lock a
> destroyed mutex, calls pthread_init twice etc. But I haven't had time
> for that yet.
> 
> Best regards,
> Daniel Fahlgren
> <pthread.diff>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140319/1bf0e2ff/attachment.html>


More information about the cfe-commits mailing list