rlib
Convenience library for useful things
Loading...
Searching...
No Matches
rtimeoutcblist.h File Reference

Ordered list of callbacks indexed by absolute deadline. More...

#include <rlib/rtypes.h>
#include <rlib/rref.h>

Go to the source code of this file.

Data Structures

struct  RTimeoutCBList
 Ordered list of RToCB entries keyed by deadline. More...
 

Macros

#define r_to_cb_ref   r_ref_ref
 Increment the entry's refcount.
 
#define r_to_cb_unref   r_ref_unref
 Decrement the entry's refcount; frees when it reaches zero.
 
#define R_TIMEOUT_CBLIST_INIT   { NULL, NULL, 0 }
 Static initialiser for an empty RTimeoutCBList.
 
#define r_timeout_cblist_init(lst)   r_memset (lst, 0, sizeof (RTimeoutCBList))
 Initialise a stack-allocated RTimeoutCBList to empty.
 
#define r_timeout_cblist_len(lst)   (lst)->size
 Number of pending callbacks.
 

Typedefs

typedef struct RToCB RToCB
 Opaque, refcounted timeout-callback entry.
 

Functions

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.
 
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.
 
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.
 

Detailed Description

Ordered list of callbacks indexed by absolute deadline.