mirror of
git://git.code.sf.net/p/sbcl/sbcl
synced 2026-09-10 07:26:40 -04:00
* SOCKET-MAKE-STREAM, and MAKE-FD-STREAM have new keyword argument :SERVE-EVENTS which requests that blocking IO on the stream should dispatch to SERVE-EVENT. For SOCKET-MAKE-STREAM the default is T, for MAKE-FD-STREAM the default it NIL. * Don't call SYSREAD-MAY-BLOCK-P at all unless we need to to handle events or check for timeout. * Make WAIT-UNTIL-FD-USABLE use UNIX-SIMPLE-POLL instead of going into SUB-SERVE-EVENT when appropriate: ** Explicit requests to not serve events. ** Timeout 0. ** No other handlers and no periodic polling function. * When FD-STREAM-SERVE-EVENTS is false but write returns EWOULDBLOCK, don't queue output but wait till poll(2) says we can go. * UNIX-SIMPLE-POLL uses poll() only on platforms where a build-time test shows it to exist and work as expected. Elsewhere it is built on top of good 'ol select().
27 lines
637 B
C
27 lines
637 B
C
/* test to build and run so that we know if we have poll that works on
|
|
* stdin and /dev/zero -- which is hopefully a sufficient sample to weed
|
|
* out crappy versions like that on Darwin.
|
|
*/
|
|
|
|
#include <fcntl.h>
|
|
#include <poll.h>
|
|
|
|
int main ()
|
|
{
|
|
struct pollfd fds;
|
|
|
|
fds.fd = 0;
|
|
fds.events = POLLIN|POLLPRI;
|
|
fds.revents = 0;
|
|
if (!((1 == poll(&fds, 1, -1)) && ((POLLIN|POLLPRI) & fds.revents)))
|
|
return 0;
|
|
|
|
fds.fd = open("/dev/zero", O_RDONLY);
|
|
fds.events = POLLIN|POLLPRI;
|
|
fds.revents = 0;
|
|
if (!((1 == poll(&fds, 1, -1)) && ((POLLIN|POLLPRI) & fds.revents)))
|
|
return 0;
|
|
|
|
return 104;
|
|
}
|