PipeWire 1.2.5
|
Register sources and work items to an event loop. More...
#include <spa/support/loop.h>
Data Fields | |
uint32_t | version |
int(* | add_source )(void *object, struct spa_source *source) |
Add a source to the loop. | |
int(* | update_source )(void *object, struct spa_source *source) |
Update the source io mask. | |
int(* | remove_source )(void *object, struct spa_source *source) |
Remove a source from the loop. | |
int(* | invoke )(void *object, spa_invoke_func_t func, uint32_t seq, const void *data, size_t size, bool block, void *user_data) |
Invoke a function in the context of this loop. | |
Register sources and work items to an event loop.
uint32_t spa_loop_methods::version |
int(* spa_loop_methods::add_source) (void *object, struct spa_source *source) |
Add a source to the loop.
Must be called from the loop's own thread.
[in] | object | The callbacks data. |
[in] | source | The source. |
int(* spa_loop_methods::update_source) (void *object, struct spa_source *source) |
Update the source io mask.
Must be called from the loop's own thread.
[in] | object | The callbacks data. |
[in] | source | The source. |
int(* spa_loop_methods::remove_source) (void *object, struct spa_source *source) |
Remove a source from the loop.
Must be called from the loop's own thread.
[in] | object | The callbacks data. |
[in] | source | The source. |
int(* spa_loop_methods::invoke) (void *object, spa_invoke_func_t func, uint32_t seq, const void *data, size_t size, bool block, void *user_data) |
Invoke a function in the context of this loop.
May be called from any thread and multiple threads at the same time. If called from the loop's thread, all callbacks previously queued with invoke() will be run synchronously, which might cause unexpected reentrancy problems.
[in] | object | The callbacks data. |
func | The function to be invoked. | |
seq | An opaque sequence number. This will be made available to func. | |
[in] | data | Data that will be copied into the internal ring buffer and made available to func. Because this data is copied, it is okay to pass a pointer to a local variable, but do not pass a pointer to an object that has identity. |
size | The size of data to copy. | |
block | If \true, do not return until func has been called. Otherwise, returns immediately. Passing \true does not risk a deadlock because the data thread is never allowed to wait on any other thread. | |
user_data | An opaque pointer passed to func. |
-EPIPE
if the internal ring buffer filled up, if block is \false, 0 if seq was SPA_ID_INVALID or seq with the ASYNC flag set or the return value of func otherwise.