#include <sys/time.h>
#include <sys/types.h>
#include <stdbool.h>
#include <stdint.h>
#include <signal.h>
#include "list.h"
Go to the source code of this file.
◆ ULOOP_BLOCKING
#define ULOOP_BLOCKING (1 << 3) |
◆ ULOOP_EDGE_TRIGGER
#define ULOOP_EDGE_TRIGGER (1 << 2) |
◆ ULOOP_ERROR_CB
#define ULOOP_ERROR_CB (1 << 6) |
◆ ULOOP_EVENT_BUFFERED
#define ULOOP_EVENT_BUFFERED (1 << 4) |
◆ ULOOP_EVENT_MASK
◆ ULOOP_READ
#define ULOOP_READ (1 << 0) |
◆ ULOOP_WRITE
#define ULOOP_WRITE (1 << 1) |
◆ USE_EPOLL
◆ uloop_fd_handler
typedef void(* uloop_fd_handler) (struct uloop_fd *u, unsigned int events) |
◆ uloop_interval_handler
◆ uloop_process_handler
typedef void(* uloop_process_handler) (struct uloop_process *c, int ret) |
◆ uloop_signal_handler
typedef void(* uloop_signal_handler) (struct uloop_signal *s) |
◆ uloop_timeout_handler
◆ uloop_cancelling()
bool uloop_cancelling |
( |
void |
| ) |
|
Definition at line 653 of file uloop.c.
static int uloop_run_depth
◆ uloop_done()
Definition at line 686 of file uloop.c.
static void uloop_clear_processes(void)
static void uloop_setup_signals(bool add)
int uloop_fd_delete(struct uloop_fd *fd)
static struct uloop_fd waker_fd
static void uloop_clear_timeouts(void)
◆ uloop_end()
static void uloop_end |
( |
void |
| ) |
|
|
inlinestatic |
◆ uloop_fd_add()
int uloop_fd_add |
( |
struct uloop_fd * |
sock, |
|
|
unsigned int |
flags |
|
) |
| |
Definition at line 235 of file uloop.c.
244 fl = fcntl(sock->
fd, F_GETFL, 0);
246 fcntl(sock->
fd, F_SETFL, fl);
static int register_poll(struct uloop_fd *fd, unsigned int flags)
uloop_fd_handler uloop_fd_set_cb
◆ uloop_fd_delete()
int uloop_fd_delete |
( |
struct uloop_fd * |
sock | ) |
|
Definition at line 265 of file uloop.c.
283 fd->registered =
false;
static int __uloop_fd_delete(struct uloop_fd *sock)
static struct uloop_fd_event cur_fds[10]
static bool uloop_fd_stack_event(struct uloop_fd *fd, int events)
◆ uloop_get_next_timeout()
int uloop_get_next_timeout |
( |
void |
| ) |
|
Definition at line 595 of file uloop.c.
static bool list_empty(const struct list_head *head)
#define list_first_entry(ptr, type, field)
static struct list_head timeouts
static int64_t tv_diff(struct timeval *t1, struct timeval *t2)
static void uloop_gettime(struct timeval *tv)
◆ uloop_init()
Definition at line 150 of file uloop.c.
static int uloop_init_pollfd(void)
static int waker_init(void)
◆ uloop_interval_cancel()
Definition at line 458 of file uloop.c.
static int timer_remove(struct uloop_interval *tm)
◆ uloop_interval_remaining()
Definition at line 463 of file uloop.c.
static int64_t timer_next(struct uloop_interval *tm)
◆ uloop_interval_set()
int uloop_interval_set |
( |
struct uloop_interval * |
timer, |
|
|
unsigned int |
msecs |
|
) |
| |
Definition at line 453 of file uloop.c.
static int timer_register(struct uloop_interval *tm, unsigned int msecs)
◆ uloop_process_add()
Definition at line 391 of file uloop.c.
static void list_add_tail(struct list_head *_new, struct list_head *head)
#define list_for_each_entry(p, h, field)
static struct list_head processes
◆ uloop_process_delete()
Definition at line 412 of file uloop.c.
static void list_del(struct list_head *entry)
◆ uloop_run()
static int uloop_run |
( |
void |
| ) |
|
|
inlinestatic |
Definition at line 147 of file uloop.h.
int uloop_run_timeout(int timeout)
◆ uloop_run_timeout()
int uloop_run_timeout |
( |
int |
timeout | ) |
|
Definition at line 658 of file uloop.c.
676 if (timeout >= 0 && (next_time < 0 || timeout < next_time))
int uloop_get_next_timeout(void)
static void uloop_run_events(int64_t timeout)
static void uloop_handle_processes(void)
static void uloop_process_timeouts(void)
◆ uloop_signal_add()
Definition at line 550 of file uloop.c.
574 sigemptyset(&sa.sa_mask);
575 sigaction(s->
signo, &sa, NULL);
static struct list_head signals
static void uloop_signal_wake(int signo)
◆ uloop_signal_delete()
◆ uloop_timeout_add()
◆ uloop_timeout_cancel()
◆ uloop_timeout_remaining()
Definition at line 359 of file uloop.c.
373 else if (td < INT_MIN)
◆ uloop_timeout_remaining64()
int64_t uloop_timeout_remaining64 |
( |
struct uloop_timeout * |
timeout | ) |
|
◆ uloop_timeout_set()
int uloop_timeout_set |
( |
struct uloop_timeout * |
timeout, |
|
|
int |
msecs |
|
) |
| |
Definition at line 328 of file uloop.c.
330 struct timeval *time = &timeout->
time;
337 time->tv_sec += msecs / 1000;
338 time->tv_usec += (msecs % 1000) * 1000;
340 if (time->tv_usec > 1000000) {
342 time->tv_usec -= 1000000;
int uloop_timeout_cancel(struct uloop_timeout *timeout)
int uloop_timeout_add(struct uloop_timeout *timeout)
◆ uloop_cancelled
◆ uloop_fd_set_cb
◆ uloop_handle_sigchld
bool uloop_handle_sigchld |
|
extern |