strange KASSERT in _sleep()

Roman Divacky rdivacky at freebsd.org
Sat Aug 11 06:03:35 PDT 2007


hi

tsleep() maps to _sleep() with lock = NULL,

the _sleep() contains this:

  KASSERT(timo != 0 || mtx_owned(&Giant) || lock != NULL ||
              ident == &lbolt, ("sleeping without a lock"));


which simplifies for tsleep(foo, ...) where foo != lbolt to
"timo != 0 || mtx_owned(&Giant)"

why do I have to hold Giant or have timo != 0 when calling tsleep?

thnx for explanation

roman



More information about the freebsd-hackers mailing list