Date: Tue, 08 May 2012 10:07:12 -0600 From: Ian Lepore <freebsd@damnhippie.dyndns.org> To: freebsd-hackers@freebsd.org Subject: Calling tsleep(9) with interrupts disabled Message-ID: <1336493232.1503.29.camel@revolution.hippie.lan>
next in thread | raw e-mail | index | archive | help
I just realized that I've accidentally coded a sequence similar to this in a driver: s = intr_disable(); // do stuff here tsleep(sc, 0, "twird", hz / 4); // more stuff intr_restore(s); Much to my surpise this works, including waking up due to wakeup(sc) being called from an interrupt handler. So apparently tsleep() results in interrupts being re-enabled during the sleep, although nothing in the manpage says that will happen. Can I safely rely on this behavior, or is it working by accident? (Please no lectures on the evils of disabling interrupts... This is not a multi-GHz multi-core Xeon, it's a 180mhz embedded SoC with buggy builtin devices that will drop or corrupt data if an interrupt happens during the "do stuff here" part of the code.) -- Ian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1336493232.1503.29.camel>