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:
parent
452d9f5b1c
commit
0fddf92d72
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user