18#ifndef __R_TIMEOUT_CBLIST_H__
19#define __R_TIMEOUT_CBLIST_H__
21#if !defined(__RLIB_H_INCLUDE_GUARD__) && !defined(RLIB_COMPILATION)
22#error "#include <rlib.h> only please."
55#define r_to_cb_ref r_ref_ref
57#define r_to_cb_unref r_ref_unref
73#define R_TIMEOUT_CBLIST_INIT { NULL, NULL, 0 }
75#define r_timeout_cblist_init(lst) r_memset (lst, 0, sizeof (RTimeoutCBList))
84#define r_timeout_cblist_len(lst) (lst)->size
#define R_API
Public-API decoration: resolves to R_API_EXPORT while building rlib and R_API_IMPORT for consumers.
Definition rmacros.h:115
#define R_BEGIN_DECLS
Open an extern "C" block under C++ (no-op in C).
Definition rmacros.h:196
RClockTime r_timeout_cblist_first_timeout(RTimeoutCBList *lst)
Return the deadline of the head entry, or R_CLOCK_TIME_NONE if the list is empty.
void r_timeout_cblist_clear(RTimeoutCBList *lst)
Cancel every pending entry and drop the list to empty.
rboolean r_timeout_cblist_insert(RTimeoutCBList *lst, RToCB **tocb, RClockTime ts, RFunc cb, rpointer data, RDestroyNotify datanotify, rpointer user, RDestroyNotify usernotify)
Schedule cb to fire at ts.
rboolean r_timeout_cblist_cancel(RTimeoutCBList *lst, RToCB *cb)
Cancel the entry identified by cb.
struct RToCB RToCB
Opaque, refcounted timeout-callback entry.
Definition rtimeoutcblist.h:53
rsize r_timeout_cblist_update(RTimeoutCBList *lst, RClockTime ts)
Fire and remove every entry whose deadline is at or before ts; returns the number called.
int rboolean
Boolean type (typedef'd to int).
Definition rtypes.h:59
void(* RFunc)(rpointer data, rpointer user)
Generic iteration callback over (data, user) pairs.
Definition rtypes.h:403
void(* RDestroyNotify)(rpointer ptr)
Destructor callback: free / release the value at ptr.
Definition rtypes.h:401
void * rpointer
Generic pointer (alias for void *).
Definition rtypes.h:327
unsigned long rsize
Unsigned pointer-sized size type (like size_t).
Definition rtypes.h:290
ruint64 RClockTime
Unsigned 64-bit timestamp / duration, in nanoseconds.
Definition rtypes.h:353
Refcount base struct shared by every refcounted type in rlib.
Foundational type aliases used by every rlib header.
Ordered list of RToCB entries keyed by deadline.
Definition rtimeoutcblist.h:65
RToCB * head
Definition rtimeoutcblist.h:66
rsize size
Definition rtimeoutcblist.h:69
RToCB * tail
Definition rtimeoutcblist.h:67