1
0
mirror of https://github.com/lammertb/libhttp.git synced 2025-04-27 00:28:51 +03:00
libhttp/doc/api/httplib_poll.md
2016-12-15 21:42:44 +01:00

28 lines
1.2 KiB
Markdown

# LibHTTP API Reference
### `httplib_poll( pfd, nfds, timeout );`
### Parameters
| Parameter | Type | Description |
| :--- | :--- | :--- |
|**`pfd`**|`struct pollfd *`|List of file descriptors|
|**`nfds`**|`unsigned int`|Number of file descriptors|
|**`timeout`**|`int`|Timeout of the wait in milliseconds|
### Return Value
| Type | Description |
| :--- | :--- |
|`int`|The number of descriptors ready for I/O or an error code|
### Description
The function `httplib_poll()` provides a platform independent way to perform asynchronous I/O. A list with file descriptors is provided as parameter to the function call. When one or more file desciptors are ready to provide I/O the function returns with the number of descriptors which are ready. An error is indicated with the value -1. An optional timeout value specifies in milliseconds after which time the function should return, even if no file descriptors are ready. The value **-1** as timeout is interpreted as an infinite wait.
On Posix compliant systems the call to this function is just a wrapper around the Posix `poll()` function. On other systems this function is implemented with own code to emulate the Posix functionality.
### See Also
* [`httplib_kill();`](httplib_kill.md)