#include <cio/sched.h>
Data Structures | |
| struct | cio_context |
| Buffer for saving stack and register state. More... | |
Defines | |
| #define | CIO_INPUT |
| File descriptor may be read from. | |
| #define | CIO_OUTPUT |
| File descriptor may be written to. | |
| #define | CIO_ERROR |
| Error while waiting for I/O. | |
| #define | CIO_HANGUP |
| Hang-up while waiting for I/O. | |
| #define | CIO_CLOSE |
| File descriptor was closed while waiting for I/O. | |
Functions | |
| int | cio_wait (int fd, int events) |
| int | cio_yield (struct cio_context *storage) |
| void | cio_run (struct cio_context *target, int value) |
| void cio_run | ( | struct cio_context * | target, | |
| int | value | |||
| ) |
Jump to another routine immediately.
| target | execution context to be resumed | |
| value | to be returned by the cio_yield() call in the target routine (must be greater than zero) |
| int cio_wait | ( | int | fd, | |
| int | events | |||
| ) |
Wait for I/O events on a file descriptor.
| fd | a file descriptor which supports polling | |
| events | bitwise OR of CIO_INPUT and/or CIO_OUTPUT |
| -1 | on error with errno set |
| int cio_yield | ( | struct cio_context * | storage | ) |
Save current execution context and schedule the next routine. This function returns after an I/O event subscribed to with cio_register() occurs or another routine calls cio_run() with the execution context stored here.
| storage | for saving the stack and register state until execution is resumed |
| -1 | on interrupt with errno set |