start page | rating of books | rating of authors | reviews | copyrights

Perl in a Nutshell

Perl in a NutshellSearch this book
Previous: Reference: select Chapter 5
Function Reference
Next: Reference: semctl
 

select

select 
rbits
, 
wbits
, 
ebits
, 
timeout

The four-argument select operator is totally unrelated to the previously described select operator. This operator is for discovering which (if any) of your file descriptors are ready to do input or output, or to report an exceptional condition. It calls the select(2) system call with the bitmasks you've specified, which you can construct using fileno and vec , like this:

$rbits = $wbits = $ebits = ""; vec($rbits, fileno(STDIN), 1) = 1; vec($wbits, fileno(STDOUT), 1) = 1; $ein = $rin | $win;
The select call blocks until one or more file descriptors is ready for reading, writing, or reporting an error condition. timeout is given in seconds and tells select how long to wait.


Previous: Reference: select Perl in a Nutshell Next: Reference: semctl
Reference: select Book Index Reference: semctl