#include <stdbool.h>
#include <curl/curl.h>
Go to the source code of this file.
|
struct io_poller * | io_poller_create (void) |
|
void | io_poller_destroy (struct io_poller *io) |
|
void | io_poller_wakeup (struct io_poller *io) |
| wakeup the thread listening to this io_poller More...
|
|
int | io_poller_poll (struct io_poller *io, int milliseconds) |
| wait for events to be triggered More...
|
|
int | io_poller_perform (struct io_poller *io) |
| performs any actions needed and clears events set by io_poller_poll More...
|
|
bool | io_poller_socket_add (struct io_poller *io, io_poller_socket sock, enum io_poller_events events, io_poller_cb cb, void *user_data) |
| adds or modifies a socket or file descriptor to watch list More...
|
|
bool | io_poller_socket_del (struct io_poller *io, io_poller_socket sock) |
| removes a socket or file descriptor from watch list More...
|
|
bool | io_poller_curlm_add (struct io_poller *io, CURLM *multi, io_poller_curl_cb cb, void *user_data) |
| add or modifies a curl multi to watch list More...
|
|
bool | io_poller_curlm_del (struct io_poller *io, CURLM *multi) |
| remove curl multi from watch list More...
|
|
bool | io_poller_curlm_enable_perform (struct io_poller *io, CURLM *multi) |
| this multi should be performed on next cycle causing poll to return immediately More...
|
|
◆ io_poller_socket
a socket or file descriptor
◆ io_poller_cb
typedef void(* io_poller_cb) (struct io_poller *io, enum io_poller_events events, void *user_data) |
callback for when an event is triggered by the socket
◆ io_poller_curl_cb
typedef int(* io_poller_curl_cb) (struct io_poller *io, CURLM *multi, void *user_data) |
callback for when curl multi should be performed on
◆ io_poller_events
The flags to poll for.
Enumerator |
---|
IO_POLLER_IN | |
IO_POLLER_OUT | |
◆ io_poller_create()
struct io_poller * io_poller_create |
( |
void |
| ) |
|
◆ io_poller_destroy()
void io_poller_destroy |
( |
struct io_poller * |
io | ) |
|
◆ io_poller_wakeup()
void io_poller_wakeup |
( |
struct io_poller * |
io | ) |
|
wakeup the thread listening to this io_poller
- Parameters
-
io | the io_poller to wake up |
◆ io_poller_poll()
int io_poller_poll |
( |
struct io_poller * |
io, |
|
|
int |
milliseconds |
|
) |
| |
wait for events to be triggered
- Parameters
-
io | the io_poller to poll on |
milliseconds | -1 for infinity, or ms to poll for |
- Returns
- -1 for error, or number of sockets that have events waiting
◆ io_poller_perform()
int io_poller_perform |
( |
struct io_poller * |
io | ) |
|
performs any actions needed and clears events set by io_poller_poll
- Parameters
-
io | the io_poller to perform on |
- Returns
- 0 on success
◆ io_poller_socket_add()
adds or modifies a socket or file descriptor to watch list
- Parameters
-
io | the io_poller to add socket to |
sock | the file descriptor or socket to handle |
events | the events to watch for |
cb | the callback for when any event is triggered |
user_data | custom user data |
- Returns
- true on success
◆ io_poller_socket_del()
removes a socket or file descriptor from watch list
- Parameters
-
io | the io_poller to remove the socket from |
sock | the file descriptor or socket to remove |
- Returns
- true on success
◆ io_poller_curlm_add()
bool io_poller_curlm_add |
( |
struct io_poller * |
io, |
|
|
CURLM * |
multi, |
|
|
io_poller_curl_cb |
cb, |
|
|
void * |
user_data |
|
) |
| |
add or modifies a curl multi to watch list
- Parameters
-
io | the io_poller to add curl multi to |
multi | the curl multi to add or modify |
cb | the callback for when curl multi should be performed on |
user_data | custom user data |
- Returns
- true on success
◆ io_poller_curlm_del()
bool io_poller_curlm_del |
( |
struct io_poller * |
io, |
|
|
CURLM * |
multi |
|
) |
| |
remove curl multi from watch list
- Parameters
-
io | the io_poller to remove curl multi from |
multi | the curl multi to remove |
- Returns
- true on success
◆ io_poller_curlm_enable_perform()
bool io_poller_curlm_enable_perform |
( |
struct io_poller * |
io, |
|
|
CURLM * |
multi |
|
) |
| |
this multi should be performed on next cycle causing poll to return immediately
- Parameters
-
io | the io_poller to enable perform on |
multi | the multi that should be performed |
- Returns
- true on success