Assert the sem lock in sem_ref() and sem_rel(), as it is required to

safely manipulate the reference count.
This commit is contained in:
Robert Watson 2004-12-23 02:22:47 +00:00
parent 452d9f5b1c
commit 0fddf92d72

View File

@ -131,6 +131,7 @@ void
sem_ref(struct ksem *ks)
{
mtx_assert(&sem_lock, MA_OWNED);
ks->ks_ref++;
DP(("sem_ref: ks = %p, ref = %d\n", ks, ks->ks_ref));
}
@ -140,6 +141,7 @@ void
sem_rel(struct ksem *ks)
{
mtx_assert(&sem_lock, MA_OWNED);
DP(("sem_rel: ks = %p, ref = %d\n", ks, ks->ks_ref - 1));
if (--ks->ks_ref == 0)
sem_free(ks);