Date: Sat, 02 Dec 1995 21:36:30 -0500 From: Robert Withrow <witr@rwwa.com> To: freebsd-hackers@FreeBSD.ORG Subject: Proper way to determine non-blocking status... Message-ID: <199512030236.VAA11976@spooky.rwwa.com>
next in thread | raw e-mail | index | archive | help
Even though it seems like it is almost never done by existing driver code, would I be correct in assuming that the *right* way to determine if a device read is allowed to sleep or not is the following? int xxread(dev_t dev, struct uio *uio, int ioflag) { if (ioflag & IO_NDELAY) { /* Can't block here */ return EWOULDBLOCK; } else { /* Otherwise try again */ /* Can sleep here */ ... } } ----------------------------------------------------------------------------- Robert Withrow, Tel: +1 617 598 4480, Fax: +1 617 598 4430 Net: witr@rwwa.COM R.W. Withrow Associates, 319 Lynnway Suite 201, Lynn MA 01901 USA
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199512030236.VAA11976>