PipeWire  0.3.33
PipeWire rt-loop object

This loop starts a new real-time thread that is designed to run the processing graph. More...

Data Structures

struct  pw_data_loop_events
 Loop events, use pw_data_loop_add_listener to add a listener. More...
 

Functions

struct pw_data_loop * pw_data_loop_new (const struct spa_dict *props)
 Make a new loop. More...
 
void pw_data_loop_add_listener (struct pw_data_loop *loop, struct spa_hook *listener, const struct pw_data_loop_events *events, void *data)
 Add an event listener to loop. More...
 
int pw_data_loop_wait (struct pw_data_loop *loop, int timeout)
 wait for activity on the loop up to timeout milliseconds. More...
 
void pw_data_loop_exit (struct pw_data_loop *loop)
 make sure the thread will exit. More...
 
struct pw_looppw_data_loop_get_loop (struct pw_data_loop *loop)
 Get the loop implementation of this data loop. More...
 
void pw_data_loop_destroy (struct pw_data_loop *loop)
 Destroy the loop. More...
 
int pw_data_loop_start (struct pw_data_loop *loop)
 Start the processing thread. More...
 
int pw_data_loop_stop (struct pw_data_loop *loop)
 Stop the processing thread. More...
 
bool pw_data_loop_in_thread (struct pw_data_loop *loop)
 Check if the current thread is the processing thread. More...
 
struct spa_thread * pw_data_loop_get_thread (struct pw_data_loop *loop)
 Get the thread object. More...
 
int pw_data_loop_invoke (struct pw_data_loop *loop, spa_invoke_func_t func, uint32_t seq, const void *data, size_t size, bool block, void *user_data)
 invoke func in the context of the thread or in the caller thread when the loop is not running. More...
 

Detailed Description

This loop starts a new real-time thread that is designed to run the processing graph.

Function Documentation

◆ pw_data_loop_add_listener()

void pw_data_loop_add_listener ( struct pw_data_loop *  loop,
struct spa_hook listener,
const struct pw_data_loop_events events,
void *  data 
)

Add an event listener to loop.

References spa_hook_list_append().

◆ pw_data_loop_destroy()

void pw_data_loop_destroy ( struct pw_data_loop *  loop)

Destroy the loop.

Destroy the loop.

Parameters
loopthe data loop to destroy

References NAME, pw_data_loop_stop(), pw_log_debug, pw_loop_destroy(), pw_loop_destroy_source, and spa_hook_list_clean().

Referenced by pw_context_destroy().

◆ pw_data_loop_exit()

void pw_data_loop_exit ( struct pw_data_loop *  loop)

make sure the thread will exit.

Can be called from a loop callback

◆ pw_data_loop_get_loop()

struct pw_loop* pw_data_loop_get_loop ( struct pw_data_loop *  loop)

Get the loop implementation of this data loop.

References pw_loop::loop.

◆ pw_data_loop_get_thread()

struct spa_thread* pw_data_loop_get_thread ( struct pw_data_loop *  loop)

Get the thread object.

Parameters
loopthe data loop to get the thread of
Returns
the thread object or NULL when the thread is not running

On posix based systems this returns a pthread_t

◆ pw_data_loop_in_thread()

bool pw_data_loop_in_thread ( struct pw_data_loop *  loop)

Check if the current thread is the processing thread.

Check if the current thread is the processing thread.

Parameters
loopthe data loop to check
Returns
true is the current thread is the data loop thread

◆ pw_data_loop_invoke()

int pw_data_loop_invoke ( struct pw_data_loop *  loop,
spa_invoke_func_t  func,
uint32_t  seq,
const void *  data,
size_t  size,
bool  block,
void *  user_data 
)

invoke func in the context of the thread or in the caller thread when the loop is not running.

Since 0.3.3

References pw_loop_invoke.

◆ pw_data_loop_new()

struct pw_data_loop* pw_data_loop_new ( const struct spa_dict props)

Make a new loop.

Make a new loop.

Returns
a newly allocated data loop

◆ pw_data_loop_start()

int pw_data_loop_start ( struct pw_data_loop *  loop)

Start the processing thread.

Start the processing thread.

Parameters
loopthe data loop to start
Returns
0 if ok, -1 on error

This will start the realtime thread that manages the loop.

References pw_loop::loop, and pw_thread_utils_create.

◆ pw_data_loop_stop()

int pw_data_loop_stop ( struct pw_data_loop *  loop)

Stop the processing thread.

Stop the processing thread.

Parameters
loopthe data loop to Stop
Returns
0

This will stop and join the realtime thread that manages the loop.

References NAME, pw_log_debug, pw_loop_signal_event, and pw_thread_utils_join.

Referenced by pw_data_loop_destroy().

◆ pw_data_loop_wait()

int pw_data_loop_wait ( struct pw_data_loop *  loop,
int  timeout 
)

wait for activity on the loop up to timeout milliseconds.

Should be called from the loop function

References pw_loop_iterate.