1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-11 08:37:59 +00:00
mpv/misc
wm4 22c002138d misc: add a synchronization helper
This is almost like rendezvous(), except it allows async wakeup, and
does not require global state. It will be used by a later commit.

struct mp_waiter is intended to be allocated on the stack, and uses an
initializer including PTHREAD_MUTEX_INITIALIZER. This is the first case
in mpv that it uses PTHREAD_MUTEX_INITIALIZER for stack-allocated
mutexes. It seems POSIX still does not allow this formally, but since
POSIX is worth less than used toilet paper, I don't really care. Modern
OSes use futexes, which means you can make _every_ memory location a
lock, and this code tries to make use of it, without using OS specific
code.

The name of the source file is rather generic, because I intend to dump
further small helpers there (or maybe move mp_rendezvous() to it).
2018-05-24 19:56:34 +02:00
..
bstr.c
bstr.h
charset_conv.c
charset_conv.h
ctype.h
dispatch.c dispatch: add an assert() 2018-05-24 19:56:33 +02:00
dispatch.h
json.c
json.h
node.c
node.h
rendezvous.c
rendezvous.h
ring.c
ring.h
thread_pool.c
thread_pool.h
thread_tools.c misc: add a synchronization helper 2018-05-24 19:56:34 +02:00
thread_tools.h misc: add a synchronization helper 2018-05-24 19:56:34 +02:00