[PATCH] make pthread checker track pthread_mutex_unlock, pthread_mutex_destroy and pthread_mutex_init

Daniel Fahlgren daniel at fahlgren.se
Sun Mar 30 22:57:04 PDT 2014


Hi,

Here are three patches for the pthread lock checker. The first detects
if a lock is unlocked twice. The second patch will make the checker warn
if a lock is destroyed twice or destroyed while being locked. The third
patch will warn if we initialize an already initialized mutex.

The first patch will use a set to track if a lock is already unlocked.
The set is changed in patch two to a map to have better knowledge about
the state of the lock.

The third patch does not track lck_mtx_init. The reason for that is that
I haven't found a good description on if is allowed to reinit a
destroyed lock, what happens if you call lck_mtx_init twice etc.

Any comments?

Cheers,
Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-support-to-detect-double-unlock.patch
Type: text/x-patch
Size: 7060 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140331/a0427b05/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Warn-if-a-destroyed-lock-is-used.patch
Type: text/x-patch
Size: 11855 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140331/a0427b05/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Track-pthread_mutex_init.patch
Type: text/x-patch
Size: 5728 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140331/a0427b05/attachment-0002.bin>


More information about the cfe-commits mailing list