| 1 | package SPVM::Sys::Select; | ||
| 2 | |||
| 3 | 1; | ||
| 4 | |||
| 5 | =head1 Name | ||
| 6 | |||
| 7 | SPVM::Sys::Select - Select System Call | ||
| 8 | |||
| 9 | =head1 Description | ||
| 10 | |||
| 11 | The Sys::Select class has methods to call the select system call. | ||
| 12 | |||
| 13 | =head1 Usage | ||
| 14 | |||
| 15 | use Sys::Select; | ||
| 16 | |||
| 17 | =head2 Details | ||
| 18 | |||
| 19 | In Windows, FD_SETSIZE is set to 1024. | ||
| 20 | |||
| 21 | =head1 Class Methods | ||
| 22 | |||
| 23 | =head2 FD_ZERO | ||
| 24 | |||
| 25 | C<static method FD_ZERO : void ($set : L<Sys::Select::Fd_set|SPVM::Sys::Select::Fd_set>);> | ||
| 26 | |||
| 27 | Calls the L<FD_ZERO|https://linux.die.net/man/2/select> function. | ||
| 28 | |||
| 29 | Exceptions: | ||
| 30 | |||
| 31 | $set must be defined. Otherwise an exception is thrown. | ||
| 32 | |||
| 33 | =head2 FD_SET | ||
| 34 | |||
| 35 | C<static method FD_SET : void ($fd : int, $set : L<Sys::Select::Fd_set|SPVM::Sys::Select::Fd_set>);> | ||
| 36 | |||
| 37 | Calls the L<FD_SET|https://linux.die.net/man/2/select> function. | ||
| 38 | |||
| 39 | Exceptions: | ||
| 40 | |||
| 41 | $fd must be greater than or equal to 0. Otherwise an exception is thrown. | ||
| 42 | |||
| 43 | $fd must be less than FD_SETSIZE. Otherwise an exception is thrown. | ||
| 44 | |||
| 45 | $set must be defined. Otherwise an exception is thrown. | ||
| 46 | |||
| 47 | =head2 FD_CLR | ||
| 48 | |||
| 49 | C<static method FD_CLR : void ($fd : int, $set : L<Sys::Select::Fd_set|SPVM::Sys::Select::Fd_set>);> | ||
| 50 | |||
| 51 | Calls the L<FD_CLR|https://linux.die.net/man/2/select> function. | ||
| 52 | |||
| 53 | Exceptions: | ||
| 54 | |||
| 55 | $fd must be greater than or equal to 0. Otherwise an exception is thrown. | ||
| 56 | |||
| 57 | $fd must be less than FD_SETSIZE. Otherwise an exception is thrown. | ||
| 58 | |||
| 59 | $set must be defined. Otherwise an exception is thrown. | ||
| 60 | |||
| 61 | =head2 FD_ISSET | ||
| 62 | |||
| 63 | C<static method FD_ISSET : int ($fd : int, $set : L<Sys::Select::Fd_set|SPVM::Sys::Select::Fd_set>);> | ||
| 64 | |||
| 65 | Calls the L<FD_ISSET|https://linux.die.net/man/2/select> function and returns its return value. | ||
| 66 | |||
| 67 | Exceptions: | ||
| 68 | |||
| 69 | $fd must be greater than or equal to 0. Otherwise an exception is thrown. | ||
| 70 | |||
| 71 | $fd must be less than FD_SETSIZE. Otherwise an exception is thrown. | ||
| 72 | |||
| 73 | $set must be defined. Otherwise an exception is thrown. | ||
| 74 | |||
| 75 | =head2 select | ||
| 76 | |||
| 77 | C<static method select : int ($nfds : int, $readfds : L<Sys::Select::Fd_set|SPVM::Sys::Select::Fd_set>, $writefds : L<Sys::Select::Fd_set|SPVM::Sys::Select::Fd_set>, $exceptfds : L<Sys::Select::Fd_set|SPVM::Sys::Select::Fd_set>, $timeout : L<Sys::Time::Timeval|SPVM::Sys::Time::Timeval>);> | ||
| 78 | |||
| 79 | Calls the L<select|https://linux.die.net/man/2/select> function and returns its return value. | ||
| 80 | |||
| 81 | Exceptions: | ||
| 82 | |||
| 83 | $fd must be greater than or equal to 0. Otherwise an exception is thrown. | ||
| 84 | |||
| 85 | $fd must be less than FD_SETSIZE. Otherwise an exception is thrown. | ||
| 86 | |||
| 87 | If the select function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class. | ||
| 88 | |||
| 89 | =head1 See Also | ||
| 90 | |||
| 91 | =over 2 | ||
| 92 | |||
| 93 | =item * L<Sys|SPVM::Sys> | ||
| 94 | |||
| 95 | =back | ||
| 96 | |||
| 97 | =head1 Copyright & License | ||
| 98 | |||
| 99 | Copyright (c) 2023 Yuki Kimoto | ||
| 100 | |||
| 101 | MIT License | ||
| 102 |