diff --git a/sleeplock.c b/sleeplock.c index d0e4d91..e0750ea 100644 --- a/sleeplock.c +++ b/sleeplock.c @@ -47,7 +47,7 @@ holdingsleep(struct sleeplock *lk) int r; acquire(&lk->lk); - r = lk->locked; + r = lk->locked && (lk->pid == myproc()->pid); release(&lk->lk); return r; }