thread-loop.h
Go to the documentation of this file.
/* PipeWire
* Copyright (C) 2015 Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __PIPEWIRE_THREAD_LOOP_H__
#define __PIPEWIRE_THREAD_LOOP_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <pipewire/loop.h>
struct pw_thread_loop;
struct pw_thread_loop_events {
#define PW_VERSION_THREAD_LOOP_EVENTS 0
uint32_t version;
void (*destroy) (void *data);
};
struct pw_thread_loop *
pw_thread_loop_new(struct pw_loop *loop, const char *name);
void pw_thread_loop_destroy(struct pw_thread_loop *loop);
void pw_thread_loop_add_listener(struct pw_thread_loop *loop,
struct spa_hook *listener,
const struct pw_thread_loop_events *events,
void *data);
struct pw_loop * pw_thread_loop_get_loop(struct pw_thread_loop *loop);
int pw_thread_loop_start(struct pw_thread_loop *loop);
void pw_thread_loop_stop(struct pw_thread_loop *loop);
void pw_thread_loop_lock(struct pw_thread_loop *loop);
void pw_thread_loop_unlock(struct pw_thread_loop *loop);
void pw_thread_loop_wait(struct pw_thread_loop *loop);
int pw_thread_loop_timed_wait(struct pw_thread_loop *loop, int wait_max_sec);
void pw_thread_loop_signal(struct pw_thread_loop *loop, bool wait_for_accept);
void pw_thread_loop_accept(struct pw_thread_loop *loop);
bool pw_thread_loop_in_thread(struct pw_thread_loop *loop);
#ifdef __cplusplus
}
#endif
#endif /* __PIPEWIRE_THREAD_LOOP_H__ */
pw_thread_loop_start
int pw_thread_loop_start(struct pw_thread_loop *loop)
Start the thread loop.
pw_loop
PipeWire loop object provides an implementation of the spa loop interfaces.
Definition: loop.h:37
pw_thread_loop_events
Thread loop events.
Definition: thread-loop.h:93
pw_thread_loop_new
struct pw_thread_loop * pw_thread_loop_new(struct pw_loop *loop, const char *name)
Make a new thread loop with the given name.
pw_thread_loop
PipeWire threaded loop object.
pw_loop::loop
struct spa_loop * loop
wrapped loop
Definition: loop.h:38
pw_thread_loop_events::destroy
void(* destroy)(void *data)
the loop is destroyed
Definition: thread-loop.h:98
pw_thread_loop_in_thread
bool pw_thread_loop_in_thread(struct pw_thread_loop *loop)
Check if inside the thread.
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.
loop.h
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.
pw_thread_loop_unlock
void pw_thread_loop_unlock(struct pw_thread_loop *loop)
Unlock the loop.
pw_thread_loop_stop
void pw_thread_loop_stop(struct pw_thread_loop *loop)
Stop the thread loop.
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.
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:179
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:169
pw_thread_loop_events::version
uint32_t version
Definition: thread-loop.h:95
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 &#39;wait_max_sec&#39; seconds until some thread calls pw_thread_loop_...
pw_thread_loop_destroy
void pw_thread_loop_destroy(struct pw_thread_loop *loop)
Destroy a thread loop.
pw_thread_loop_lock
void pw_thread_loop_lock(struct pw_thread_loop *loop)
Lock the loop.