upipe/upump.h header reference
Upipe event loop handling More
Header inclusion
Members
Types
- struct upump
- typedef void (*upump_cb)(struct upump *)
- struct upump_mgr
- enum upump_mgr_command
- enum upump_type
Functions
- struct upump * upump_alloc_fd_read(struct upump_mgr *mgr, upump_cb cb, void *opaque, int fd)
- struct upump * upump_alloc_fd_write(struct upump_mgr *mgr, upump_cb cb, void *opaque, int fd)
- struct upump * upump_alloc_idler(struct upump_mgr *mgr, upump_cb cb, void *opaque)
- struct upump * upump_alloc_timer(struct upump_mgr *mgr, upump_cb cb, void *opaque, uint64_t after, uint64_t repeat)
- void upump_free(struct upump *upump)
- void upump_mgr_release(struct upump_mgr *mgr)
- void upump_mgr_set_opaque(struct upump_mgr *upump_mgr, void *opaque)
- struct upump_mgr * upump_mgr_use(struct upump_mgr *mgr)
- int upump_mgr_vacuum(struct upump_mgr *mgr)
- void upump_set_cb(struct upump *upump, upump_cb cb, void *opaque)
- void upump_start(struct upump *upump)
- void upump_stop(struct upump *upump)
Macros
Description
Members detail
This macro is declared in upipe/upump.h source file, line 31.
This struct is declared in upipe/upump.h source file, line 77.
This struct stores a pump of a given event loop.
The structure is not refcounted and shouldn't be used by more than one thread at once.
Field | Description |
---|---|
struct uchain uchain; | structure for double-linked lists - for use by the allocating pipe |
struct upump_mgr *mgr; | pointer to the event loop manager |
bool started; | true if upump_start() was called on the pump |
struct uchain blockers; | blockers registered on this pump |
upump_cb cb; | function to call back when triggered |
void *opaque; | opaque pointer for the callback |
This function is declared in upipe/upump.h source file, line 205.
This function allocates and initializes a pump for a readable file descriptor.
Parameters list:
- mgr: management structure for this event loop
- cb: function to call when the pump triggers
- opaque: pointer to the module's internal structure
- fd: file descriptor to watch
The return value is pointer to allocated pump, or NULL in case of failure
This function is declared in upipe/upump.h source file, line 220.
This function allocates and initializes a pump for a writable file descriptor.
Parameters list:
- mgr: management structure for this event loop
- cb: function to call when the pump triggers
- opaque: pointer to the module's internal structure
- fd: file descriptor to watch
The return value is pointer to allocated pump, or NULL in case of failure
This function is declared in upipe/upump.h source file, line 172.
This function allocates and initializes an idler pump.
Parameters list:
- mgr: management structure for this event loop
- cb: function to call when the pump triggers
- opaque: pointer to the module's internal structure
The return value is pointer to allocated pump, or NULL in case of failure
struct upump * upump_alloc_timer(struct upump_mgr *mgr, upump_cb cb, void *opaque, uint64_t after, uint64_t repeat)
This function is declared in upipe/upump.h source file, line 190.
This function allocates and initializes a pump for a timer.
Parameters list:
- mgr: management structure for this event loop
- cb: function to call when the pump triggers
- opaque: pointer to the module's internal structure
- after: time after which it triggers, in ticks of a 27 MHz monotonic clock
- repeat: pump will trigger again each repeat occurrence, in ticks of a 27 MHz monotonic clock (0 to disable)
The return value is pointer to allocated pump, or NULL in case of failure
typedef void (*upump_cb)(struct upump *)
This typedef is declared in upipe/upump.h source file, line 70.
function called when a pump is triggered
void upump_free(struct upump *upump)
This function is declared in upipe/upump.h source file, line 248.
This function frees a struct upump structure. Please note that the pump must be stopped before.
Parameters list:
- upump: description structure of the pump
This macro is declared in upipe/upump.h source file, line 257.
This macro gets the opaque structure with a cast.
Parameters list:
- upump: description structure of the pump
- type: type to cast to return opaque
This struct is declared in upipe/upump.h source file, line 107.
This struct stores common management parameters for a given event loop.
Field | Description |
---|---|
struct urefcount *refcount; | pointer to refcount management structure |
struct uchain uchain; | structure for double-linked lists - for use by the application only |
void *opaque; | opaque - for use by the application only |
struct upump *(*upump_alloc)(struct upump_mgr *, enum upump_type , va_list ) ; | function to create a pump |
void (*upump_start)(struct upump *) ; | function to start a pump |
void (*upump_stop)(struct upump *) ; | function to stop a pump |
void (*upump_free)(struct upump *) ; | function to free the pump |
struct upump_blocker *(*upump_blocker_alloc)(struct upump *) ; | function to create a blocker |
void (*upump_blocker_free)(struct upump_blocker *) ; | function to free the blocker |
int (*upump_mgr_control)(struct upump_mgr *, int , va_list ) ; | control function for standard or local manager commands - all parameters belong to the caller |
See also upipe_pthread_upump_mgr_alloc typedef.
This enum is declared in upipe/upump.h source file, line 97.
This enum defines standard commands which upump managers may implement.
Identifier | Value | Description |
---|---|---|
UPUMP_MGR_VACUUM | 0 | release all buffers kept in pools (void) |
UPUMP_MGR_CONTROL_LOCAL | 0 | non-standard manager commands implemented by a module type can start from there (first arg = signature) |
This macro is declared in upipe/upump.h source file, line 300.
This macro gets the opaque member of a upump manager.
Parameters list:
- upump_mgr: pointer to upump_mgr
- type: type to cast to
The return value is opaque
void upump_mgr_release(struct upump_mgr *mgr)
This function is declared in upipe/upump.h source file, line 290.
This function decrements the reference count of a upump manager of frees it.
Parameters list:
- mgr: pointer to upump manager
void upump_mgr_set_opaque(struct upump_mgr *upump_mgr, void *opaque)
This function is declared in upipe/upump.h source file, line 310.
This function sets the opaque member of a upump manager
Parameters list:
- upump_mgr: pointer to upump_mgr
- opaque: opaque
This function is declared in upipe/upump.h source file, line 278.
This function increments the reference count of a upump manager.
Parameters list:
- mgr: pointer to upump manager
The return value is same pointer to upump manager
int upump_mgr_vacuum(struct upump_mgr *mgr)
This function is declared in upipe/upump.h source file, line 358.
This function instructs an existing upump manager to release all structures currently kept in pools. It is inteded as a debug tool only.
Parameters list:
- mgr: pointer to upump manager
The return value is an error code
This function is declared in upipe/upump.h source file, line 267.
This function sets the callback parameters of an existing pump.
Parameters list:
- upump: description structure of the pump
- cb: function to call when the pump triggers
- opaque: pointer to the module's internal structure
void upump_start(struct upump *upump)
This function is declared in upipe/upump.h source file, line 229.
This function asks the event loop to start monitoring a pump.
Parameters list:
- pump: description structure of the pump
void upump_stop(struct upump *upump)
This function is declared in upipe/upump.h source file, line 238.
This function asks the event loop to stop monitoring a pump.
Parameters list:
- pump: description structure of the pump
This enum is declared in upipe/upump.h source file, line 54.
types of pumps
Identifier | Value | Description |
---|---|---|
UPUMP_TYPE_IDLER | 0 | event continuously triggers (no argument) |
UPUMP_TYPE_TIMER | 1 | event triggers once after a given timeout (arguments = uint64_t, uint64_t) |
UPUMP_TYPE_FD_READ | 2 | event triggers on available data from file descriptor (argument = int) |
UPUMP_TYPE_FD_WRITE | 3 | event triggers on available writing space to file descriptor (argument = int) |
struct upump * upump_alloc(struct upump_mgr *mgr, upump_cb cb, void *opaque, enum upump_type event, ...)
This function is for internal use only.
This function is declared in upipe/upump.h source file, line 148.
This function allocates and initializes a pump.
Parameters list:
- mgr: management structure for this event loop
- cb: function to call when the pump triggers
- opaque: pointer to the module's internal structure
- event: type of event to watch for, followed by optional parameters
The return value is pointer to allocated pump, or NULL in case of failure
This function is for internal use only.
This function is declared in UBASE_FROM_TO function like macro expansion, line 19 in upipe/upump.h source file, line 94.
This function returns a pointer to uchain.
Parameters list:
- sub: pointer to struct uchain
The return value is pointer to struct upump
int upump_mgr_control(struct upump_mgr *mgr, int command, ...)
This function is for internal use only.
This function is declared in upipe/upump.h source file, line 342.
This function sends a control command to the pipe manager. Note that thread semantics depend on the pipe manager. Also note that all arguments are owned by the caller.
Parameters list:
- mgr: pointer to upump manager
- command: control manager command to send, followed by optional read or write parameters
The return value is an error code
int upump_mgr_control_va(struct upump_mgr *mgr, int command, va_list args)
This function is for internal use only.
This function is declared in upipe/upump.h source file, line 324.
This function sends a control command to the upump manager. Note that all arguments are owned by the caller.
Parameters list:
- mgr: pointer to upump manager
- command: manager control command to send
- args: optional read or write parameters
The return value is an error code
This function is for internal use only.
This function is declared in UBASE_FROM_TO function like macro expansion, line 19 in upipe/upump.h source file, line 135.
This function returns a pointer to uchain.
Parameters list:
- sub: pointer to struct uchain
The return value is pointer to struct upump_mgr
This function is for internal use only.
This function is declared in UBASE_FROM_TO function like macro expansion, line 9 in upipe/upump.h source file, line 135.
This function returns a pointer to uchain.
Parameters list:
- upump_mgr: pointer to struct upump_mgr
The return value is pointer to struct uchain
This function is for internal use only.
This function is declared in UBASE_FROM_TO function like macro expansion, line 9 in upipe/upump.h source file, line 94.
This function returns a pointer to uchain.
Parameters list:
- upump: pointer to struct upump
The return value is pointer to struct uchain