]> git.ipfire.org Git - thirdparty/zstd.git/commit
Fixes two bugs in the Windows thread / pthread translation layer
authorYonatan Komornik <yoniko@gmail.com>
Fri, 16 Dec 2022 00:11:56 +0000 (16:11 -0800)
committerYonatan Komornik <yoniko@gmail.com>
Sat, 17 Dec 2022 21:38:02 +0000 (13:38 -0800)
commit500f02eb66419d399a521e685825846c4da0acf2
tree859cf72f1efc97b3f418aed62780fe648b2b36b4
parentfba704f8bb00ffffd1ee5cf1d35113a9e08b2c0c
Fixes two bugs in the Windows thread / pthread translation layer

1. If threads are resized the threads' `ZSTD_pthread_t` might move
while the worker still holds a pointer into it (see more details in #3120).
2. The join operation was waiting for a thread and then return its `thread.arg`
as a return value, but since the `ZSTD_pthread_t thread` was passed by value it
would have a stale `arg` that wouldn't match the thread's actual return value.

This fix changes the `ZSTD_pthread_join` API and removes support for returning
a value. This means that we are diverging from the `pthread_join` API and this
is no longer just an alias.
In the future, if needed, we could return a Windows thread's return value using
`GetExitCodeThread`, but as this path wouldn't be excised in any case, it's
preferable to not add it right now.
lib/common/pool.c
lib/common/threading.c
lib/common/threading.h
tests/fuzzer.c