]> git.ipfire.org Git - thirdparty/glibc.git/commit
test-dlclose-exit-race: avoid hang on pthread_create error
authorDJ Delorie <dj@redhat.com>
Tue, 3 Aug 2021 20:33:29 +0000 (16:33 -0400)
committerDJ Delorie <dj@redhat.com>
Wed, 4 Aug 2021 19:33:21 +0000 (15:33 -0400)
commitac30324c67d94696fdb0799e9d4fc51dc70d490b
tree5f20415a57ead411db07f887ad0b6107539cddca
parentb17e842a60819098d2a203ecc8b8371b7e1d6c65
test-dlclose-exit-race: avoid hang on pthread_create error

This test depends on the "last" function being called in a
different thread than the "first" function, as "last" posts
a semaphore that "first" is waiting on.  However, if pthread_create
fails - for example, if running in an older container before
the clone3()-in-container-EPERM fixes - exit() is called in the
same thread as everything else, the semaphore never gets posted,
and first hangs.

The fix is to pre-post that semaphore before a single-threaded
exit.

Reviewed-by: Arjun Shankar <arjun@redhat.com>
stdlib/test-dlclose-exit-race.c