PipeWire 1.6.8

Loading...
Searching...
No Matches
thread-loop.h
Go to the documentation of this file.
1/* PipeWire */
2/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
3/* SPDX-License-Identifier: MIT */
4
5#ifndef PIPEWIRE_THREAD_LOOP_H
6#define PIPEWIRE_THREAD_LOOP_H
7
8#include <pipewire/loop.h>
9
10#ifdef __cplusplus
11 extern "C" {
12#endif
13
80
85 struct pw_thread_loop;
86
88 struct pw_thread_loop_events {
89#define PW_VERSION_THREAD_LOOP_EVENTS 0
90 uint32_t version;
91
93 void (*destroy) (void *data);
94};
95
97 struct pw_thread_loop *
98 pw_thread_loop_new(const char *name, const struct spa_dict *props);
99
101
102 struct pw_thread_loop *
103 pw_thread_loop_new_full(struct pw_loop *loop, const char *name, const struct spa_dict *props);
104
106 void pw_thread_loop_destroy(struct pw_thread_loop *loop);
107
109 void pw_thread_loop_add_listener(struct pw_thread_loop *loop,
110 struct spa_hook *listener,
111 const struct pw_thread_loop_events *events,
112 void *data);
113
115 struct pw_loop * pw_thread_loop_get_loop(struct pw_thread_loop *loop);
116
118 int pw_thread_loop_start(struct pw_thread_loop *loop);
119
121 void pw_thread_loop_stop(struct pw_thread_loop *loop);
122
124 void pw_thread_loop_lock(struct pw_thread_loop *loop);
125
127 void pw_thread_loop_unlock(struct pw_thread_loop *loop);
128
131 void pw_thread_loop_wait(struct pw_thread_loop *loop);
132
136 int pw_thread_loop_timed_wait(struct pw_thread_loop *loop, int wait_max_sec);
137
141 int pw_thread_loop_get_time(struct pw_thread_loop *loop, struct timespec *abstime, int64_t timeout);
142
147 int pw_thread_loop_timed_wait_full(struct pw_thread_loop *loop, const struct timespec *abstime);
148
151 void pw_thread_loop_signal(struct pw_thread_loop *loop, bool wait_for_accept);
152
155 void pw_thread_loop_accept(struct pw_thread_loop *loop);
156
158 bool pw_thread_loop_in_thread(struct pw_thread_loop *loop);
159
163
164#ifdef __cplusplus
165}
166#endif
167
168#endif /* PIPEWIRE_THREAD_LOOP_H */
pw_thread_loop_unlock
void pw_thread_loop_unlock(struct pw_thread_loop *loop)
Unlock the loop.
Definition thread-loop.c:272
pw_thread_loop_start
int pw_thread_loop_start(struct pw_thread_loop *loop)
Start the thread loop.
Definition thread-loop.c:198
pw_thread_loop_timed_wait
int pw_thread_loop_timed_wait(struct pw_thread_loop *loop, int wait_max_sec)
Release the lock and wait a maximum of 'wait_max_sec' seconds until some thread calls pw_thread_loop_...
Definition thread-loop.c:314
pw_thread_loop_add_listener
void pw_thread_loop_add_listener(struct pw_thread_loop *loop, struct spa_hook *listener, const struct pw_thread_loop_events *events, void *data)
Add an event listener.
Definition thread-loop.c:151
pw_thread_loop_get_loop
struct pw_loop * pw_thread_loop_get_loop(struct pw_thread_loop *loop)
Get the loop implementation of the thread loop.
Definition thread-loop.c:161
pw_thread_loop_destroy
void pw_thread_loop_destroy(struct pw_thread_loop *loop)
Destroy a thread loop.
Definition thread-loop.c:134
pw_thread_loop_get_time
int pw_thread_loop_get_time(struct pw_thread_loop *loop, struct timespec *abstime, int64_t timeout)
Get a struct timespec suitable for pw_thread_loop_timed_wait_full.
Definition thread-loop.c:335
pw_thread_loop_accept
void pw_thread_loop_accept(struct pw_thread_loop *loop)
Signal all threads executing pw_thread_loop_signal with wait_for_accept.
Definition thread-loop.c:360
pw_thread_loop_stop
void pw_thread_loop_stop(struct pw_thread_loop *loop)
Stop the thread loop.
Definition thread-loop.c:240
pw_thread_loop_lock
void pw_thread_loop_lock(struct pw_thread_loop *loop)
Lock the loop.
Definition thread-loop.c:260
pw_thread_loop_new_full
struct pw_thread_loop * pw_thread_loop_new_full(struct pw_loop *loop, const char *name, const struct spa_dict *props)
Make a new thread loop with the given loop, name and optional properties.
Definition thread-loop.c:126
pw_thread_loop_in_thread
bool pw_thread_loop_in_thread(struct pw_thread_loop *loop)
Check if inside the thread.
Definition thread-loop.c:372
pw_thread_loop_new
struct pw_thread_loop * pw_thread_loop_new(const char *name, const struct spa_dict *props)
Make a new thread loop with the given name and optional properties.
Definition thread-loop.c:105
pw_thread_loop_wait
void pw_thread_loop_wait(struct pw_thread_loop *loop)
Release the lock and wait until some thread calls pw_thread_loop_signal.
Definition thread-loop.c:300
pw_thread_loop_timed_wait_full
int pw_thread_loop_timed_wait_full(struct pw_thread_loop *loop, const struct timespec *abstime)
Release the lock and wait up to abstime until some thread calls pw_thread_loop_signal.
Definition thread-loop.c:349
pw_thread_loop_signal
void pw_thread_loop_signal(struct pw_thread_loop *loop, bool wait_for_accept)
Signal all threads waiting with pw_thread_loop_wait This must be called with the loop locked.
Definition thread-loop.c:288
loop.h
pipewire/loop.h
pw_loop
Definition loop.h:33
pw_loop::loop
struct spa_loop * loop
wrapped loop
Definition loop.h:35
pw_thread_loop_events
Thread loop events.
Definition thread-loop.h:93
pw_thread_loop_events::destroy
void(* destroy)(void *data)
the loop is destroyed
Definition thread-loop.h:99
pw_thread_loop_events::version
uint32_t version
Definition thread-loop.h:96
pw_thread_loop
spa_dict
Definition dict.h:51
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:427