PipeWire 1.1.0
Loading...
Searching...
No Matches
spa_loop_methods Struct Reference

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.
 

Detailed Description

Register sources and work items to an event loop.

Field Documentation

◆ version

uint32_t spa_loop_methods::version

◆ add_source

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.

Parameters
[in]objectThe callbacks data.
[in]sourceThe source.
Returns
0 on success, negative errno-style value on failure.

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

Parameters
[in]objectThe callbacks data.
[in]sourceThe source.
Returns
0 on success, negative errno-style value on failure.

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

Parameters
[in]objectThe callbacks data.
[in]sourceThe source.
Returns
0 on success, negative errno-style value on failure.

◆ invoke

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 the loop's thread, but otherwise can only be called by a single thread at a time. If called from the loop's thread, all callbacks previously queued with invoke() will be run synchronously, which might cause unexpected reentrancy problems.

Parameters
[in]objectThe callbacks data.
funcThe function to be invoked.
seqAn opaque sequence number. This will be made available to func.
[in]dataData 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.
sizeThe size of data to copy.
blockIf \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_dataAn opaque pointer passed to func.
Returns
-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.

The documentation for this struct was generated from the following file: