mtx_lock_recurse/mtx_unlock_recurse functions (proof-of-concept).
Pawel Jakub Dawidek
pjd at FreeBSD.org
Thu Apr 8 14:36:49 PDT 2004
Hi.
As was discussed, it will be helpful to have functions, that are able
to acquire lock recursively, even if lock itself isn't recursable.
Here is a patch, that should implement this functionality:
http://people.freebsd.org/~pjd/patches/mtx_lock_recurse.patch
I also added a KASSERT() to protect against mixed locking modes, e.g.:
mtx_lock(&mtx);
[...]
mtx_lock_recurse(&mtx);
[...]
mtx_unlock(&mtx);
[...]
mtx_unlock_recurse(&mtx);
This is not permitted, but this should work just fine:
mtx_lock(&mtx);
[...]
mtx_lock_recurse(&mtx);
[...]
mtx_unlock_recurse(&mtx);
[...]
mtx_unlock(&mtx);
--
Pawel Jakub Dawidek http://www.FreeBSD.org
pjd at FreeBSD.org http://garage.freebsd.pl
FreeBSD committer Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20040408/8e4e12cc/attachment.bin
More information about the freebsd-arch
mailing list