1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00
FFmpeg/compat
Anton Khirnov d2096679d5 compat/w32pthreads: change pthread_t into pointer to malloced struct
pthread_t is currently defined as a struct, which gets placed into
caller's memory and filled by pthread_create() (which accepts a
pthread_t*).

The problem with this approach is that pthread_join() accepts pthread_t
itself rather than a pointer to it, so it gets a _copy_ of this
structure. This causes non-deterministic failures of pthread_join() to
produce the correct return value - depending on whether the thread
already finished before pthread_join() is called (and thus the copy
contains the correct value), or not (then it contains 0).

Change the definition of pthread_t into a pointer to a struct, that gets
malloced by pthread_create() and freed by pthread_join().

Fixes random failures of fate-ffmpeg-error-rate-fail on Windows after
433cf391f5.

See also [1] for an alternative approach that does not require dynamic
allocation, but relies on an assumption that the pthread_t value
remains in a fixed memory location.

[1] 23829dd2b2

Reviewed-By: Martin Storsjö <martin@martin.st>
2024-12-16 09:43:19 +01:00
..
aix all: Make header guard names consistent 2016-01-31 15:44:11 -08:00
atomics compat: drop gcc, suncc, and pthreads stdatomic emulation 2024-09-23 17:08:46 +02:00
cuda compat/cuda: switch from powf to __powf intrinsic 2022-09-03 20:27:34 +02:00
dispatch_semaphore Merge commit '6bb99757b780144d9fa27cdce09d3621e1a0ed43' 2016-05-08 23:02:33 +01:00
djgpp additional math.h functions for djgpp 2018-11-28 22:16:07 +11:00
float
msvcrt fix broken links to msdn documentation 2021-05-13 09:13:03 +10:00
solaris compat/solaris/make_sunver.pl: Use /usr/bin/env perl instead of /usr/bin/perl 2015-10-20 02:21:34 +02:00
stdbit compat: Fix the fallback definition of stdc_trailing_zeros 2024-09-24 14:00:27 +03:00
windows compat: Use '-' instead of '/' for rc.exe options 2023-02-13 13:49:40 +02:00
getopt.c
os2threads.h compat/os2threads: define INCL_DOSERRORS 2020-02-15 18:25:51 +01:00
strtod.c compat/strtod: Add missing const qualifiers. 2017-05-04 23:17:20 +02:00
va_copy.h all: Add missing header guards 2016-01-28 19:49:48 -08:00
w32dlfcn.h avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
w32pthreads.h compat/w32pthreads: change pthread_t into pointer to malloced struct 2024-12-16 09:43:19 +01:00