]> git.ipfire.org Git - thirdparty/zstd.git/commit
Fix race condition in the Windows thread / pthread translation layer
authorYonatan Komornik <yoniko@gmail.com>
Sat, 17 Dec 2022 02:24:02 +0000 (18:24 -0800)
committerYonatan Komornik <yoniko@gmail.com>
Sat, 17 Dec 2022 21:38:02 +0000 (13:38 -0800)
commitec42c92aaa13815164bb0ecb6e2483aff2fc78d9
treef79d5db91c55f288071ef2214c825b3f8ac0e5f7
parent500f02eb66419d399a521e685825846c4da0acf2
Fix race condition in the Windows thread / pthread translation layer

When spawning a Windows thread we have small worker wrapper function that translates
between the interfaces of Windows and POSIX threads.
This wrapper is given a pointer that might get stale before the worker starts running,
resulting in UB and crashes.
This commit adds synchronization so that we know the wrapper has finished reading the data
it needs before we allow the main thread to resume execution.
lib/common/threading.c
lib/common/threading.h