1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-18 12:55:16 +00:00
mpv/misc
wm4 559fe1daac Add Plan 9-style barriers
Plan 9 has a very interesting synchronization mechanism, the
rendezvous() call. A good property of this is that you don't need to
explicitly initialize and destroy a barrier object, unlike as with e.g.
POSIX barriers (which are mandatory to begin with). Upon "meeting", they
can exchange a value.

This mechanism will be nice to synchronize certain stages of
initialization between threads in the following commit.

Unlike Plan 9 rendezvous(), this is not implemented with a hashtable,
because that would require additional effort (especially if you want to
make it actually scele). Unlike the Plan 9 variant, we use intptr_t
instead of void* as type for the value, because I expect that we will be
mostly passing a status code as value and not a pointer. Converting an
integer to void* requires two cast (because the integer needs to be
intptr_t), the other way around it's only one cast.

We don't particularly care about performance in this case either. It's
simply not important for our use-case. So a simple linked list is used
for waiters, and on wakeup, all waiters are temporarily woken up.
2014-07-26 20:29:48 +02:00
..
charset_conv.c sub: add detection via BOM 2014-07-22 23:40:48 +02:00
charset_conv.h
ctype.h Audit and replace all ctype.h uses 2014-07-01 23:11:08 +02:00
dispatch.c Fix gcc 4.7 warning about shadowing talloc_parent in mp_dispact_queue 2014-05-28 22:44:43 +02:00
dispatch.h dispatch: move into its own source file 2014-04-23 21:16:51 +02:00
rendezvous.c Add Plan 9-style barriers 2014-07-26 20:29:48 +02:00
rendezvous.h Add Plan 9-style barriers 2014-07-26 20:29:48 +02:00
ring.c ring: use a different type for read/write pointers 2014-05-30 02:15:25 +02:00
ring.h