PipeWire
0.2.9
|
PipeWire threaded loop object. More...
Public Member Functions | |
SPA_EXPORT struct pw_thread_loop * | pw_thread_loop_new (struct pw_loop *loop, const char *name) |
Create a new pw_thread_loop. More... | |
SPA_EXPORT void | pw_thread_loop_destroy (struct pw_thread_loop *loop) |
Destroy a threaded loop. More... | |
SPA_EXPORT int | pw_thread_loop_start (struct pw_thread_loop *loop) |
Start the thread to handle loop. More... | |
SPA_EXPORT void | pw_thread_loop_stop (struct pw_thread_loop *loop) |
Quit the loop and stop its thread. More... | |
SPA_EXPORT void | pw_thread_loop_lock (struct pw_thread_loop *loop) |
Lock the mutex associated with loop. More... | |
SPA_EXPORT void | pw_thread_loop_unlock (struct pw_thread_loop *loop) |
Unlock the mutex associated with loop. More... | |
SPA_EXPORT void | pw_thread_loop_signal (struct pw_thread_loop *loop, bool wait_for_accept) |
Signal the thread. More... | |
SPA_EXPORT void | pw_thread_loop_wait (struct pw_thread_loop *loop) |
Wait for the loop thread to call pw_thread_loop_signal() More... | |
SPA_EXPORT int | pw_thread_loop_timed_wait (struct pw_thread_loop *loop, int wait_max_sec) |
Wait for the loop thread to call pw_thread_loop_signal() or time out. More... | |
SPA_EXPORT void | pw_thread_loop_accept (struct pw_thread_loop *loop) |
Signal the loop thread waiting for accept with pw_thread_loop_signal() More... | |
SPA_EXPORT bool | pw_thread_loop_in_thread (struct pw_thread_loop *loop) |
Check if we are inside the thread of the loop. More... | |
PipeWire threaded loop object.
The threaded loop object runs a pw_loop in a separate thread and ensures proper locking is done.
All of the loop callbacks will be executed with the loop lock held.
See also Threaded Loop
SPA_EXPORT void pw_thread_loop_accept | ( | struct pw_thread_loop * | loop | ) |
Signal the loop thread waiting for accept with pw_thread_loop_signal()
loop | a pw_thread_loop to signal |
SPA_EXPORT void pw_thread_loop_destroy | ( | struct pw_thread_loop * | loop | ) |
Destroy a threaded loop.
References pw_loop_destroy_source, pw_thread_loop_events_destroy, and pw_thread_loop_stop().
SPA_EXPORT bool pw_thread_loop_in_thread | ( | struct pw_thread_loop * | loop | ) |
Check if we are inside the thread of the loop.
loop | a pw_thread_loop to signal |
SPA_EXPORT void pw_thread_loop_lock | ( | struct pw_thread_loop * | loop | ) |
Lock the mutex associated with loop.
loop | a pw_thread_loop |
References pw_log::pw_log_trace.
SPA_EXPORT struct pw_thread_loop * pw_thread_loop_new | ( | struct pw_loop * | loop, |
const char * | name | ||
) |
Create a new pw_thread_loop.
loop | the loop to wrap |
name | the name of the thread or NULL |
Make a new pw_thread_loop that will run loop in a thread with name.
After this function you should probably call pw_thread_loop_start() to actually start the thread
References CHECK, pw_log::pw_log_debug, and pw_loop_add_event.
SPA_EXPORT void pw_thread_loop_signal | ( | struct pw_thread_loop * | loop, |
bool | wait_for_accept | ||
) |
Signal the thread.
loop | a pw_thread_loop to signal |
wait_for_accept | if we need to wait for accept |
Signal the thread of loop. If wait_for_accept is true, this function waits until pw_thread_loop_accept() is called.
References pw_log::pw_log_trace.
SPA_EXPORT int pw_thread_loop_start | ( | struct pw_thread_loop * | loop | ) |
SPA_EXPORT void pw_thread_loop_stop | ( | struct pw_thread_loop * | loop | ) |
Quit the loop and stop its thread.
loop | a pw_thread_loop |
References pw_log::pw_log_debug, and pw_loop_signal_event.
Referenced by pw_thread_loop_destroy().
SPA_EXPORT int pw_thread_loop_timed_wait | ( | struct pw_thread_loop * | loop, |
int | wait_max_sec | ||
) |
Wait for the loop thread to call pw_thread_loop_signal() or time out.
loop | a pw_thread_loop to signal |
wait_max_sec | the maximum number of seconds to wait for a pw_thread_loop_signal() |
SPA_EXPORT void pw_thread_loop_unlock | ( | struct pw_thread_loop * | loop | ) |
Unlock the mutex associated with loop.
loop | a pw_thread_loop |
References pw_log::pw_log_trace.
SPA_EXPORT void pw_thread_loop_wait | ( | struct pw_thread_loop * | loop | ) |
Wait for the loop thread to call pw_thread_loop_signal()
loop | a pw_thread_loop to signal |
References pw_log::pw_log_trace.