Topic : The ATARI Compendium
Author : Scott Sanders / JAY Software
Version : 1.25 (20/6/2003)
Subject : Documentation
Nodes : 1117
Index Size : 32614
HCP-Version : 6
Compiled on : Atari
@charset : UTF-8
@lang : en
@default :
@help : %About
@options : +g -i -t4 +y +z
@width : 100
View Ref-FileFinstat()Foutstat()Fselect() GEMDOSSyntaxWORD Fselect( timeout, rfds, wfds, reserved )
WORD timeout;
LONG *rfds, *wfds;
LONG reserved;
Function Fselect() enumerates file descriptors which are ready for
reading and/or writing.
Opcode 285 (0x11D)
Availability This function is available under all MiNTversions integrated with MultiTOS.
Parameters timeout specifies the maximum amount of time (in
milliseconds) to wait for at least one of the specified file
descriptors to become unblocked. If timeout is 0 then the
process will wait indefinitely. rfds and wfds each point to
a LONG bitmap describing the read and write file descriptors
to wait for. Setting bit #10 of the LONG pointed to by rfds,
for example, will cause Fselect() to return when GEMDOS handle 10 is available for reading. As many read or write
file descriptors can be specified per call as desired.
Specifying NULL for either rfds or wfds is the same as
passing a pointer to a LONG with no bits set. Upon return the
LONGs pointed to by rfds and wfds will be filled in with
a similar bitmap indicating which handles are ready to be
read/written. reserved should always be set to 0L.
Binding move.l reserved,-(sp)
pea wfds
pea rfds
move.w timeout,-(sp)
move.w #$11D,-(sp)
trap #1
lea 16(sp),sp
Return Value Fselect() returns the sum of bits set in both rfds and wfds.
A return value of 0 indicates that the function timed out
before any of the specified file handles became available.
A negative GEMDOS error code is returned if the function
failed.
Caveats Fselect() does not currently work on any BIOS device except
the keyboard.
Comments Fselect( 0L, 0L, 0L, 0L) will block the calling process
forever.
See Also Finstat(), Foutstat()