diff options
author | DJ Delorie <dj@redhat.com> | 2023-05-15 22:50:35 -0400 |
---|---|---|
committer | DJ Delorie <dj@redhat.com> | 2023-05-16 15:09:18 -0400 |
commit | 088136aa02de6fa13061ef6f754071a5652fdabd (patch) | |
tree | 0ae9a5cf6eb6f5dff00ff0de893dd00a75bf4447 /stdio-common/printf_buffer_as_file.h | |
parent | d877b52d58b1c73810751bdb48987b84bda87d5e (diff) | |
download | glibc-088136aa02de6fa13061ef6f754071a5652fdabd.tar.gz glibc-088136aa02de6fa13061ef6f754071a5652fdabd.tar.xz glibc-088136aa02de6fa13061ef6f754071a5652fdabd.zip |
i386: Use pthread_barrier for synchronization on tst-bz21269
So I was able to reproduce the hangs in the original source, and debug it, and fix it. In doing so, I realized that we can't use anything complex to trigger the thread because that "anything" might also cause the expected segfault and force everything out of sync again. Here's what I ended up with, and it doesn't seem to hang where the original one hung quite often (in a tight while..end loop). The key changes are: 1. Calls to futex are error checked, with retries, to ensure that the futexes are actually doing what they're supposed to be doing. In the original code, nearly every futex call returned an error. 2. The main loop has checks for whether the thread ran or not, and "unlocks" the thread if it didn't (this is how the original source hangs). Note: the usleep() is not for timing purposes, but just to give the kernel an excuse to run the other thread at that time. The test will not hang without it, but is more likely to test the right bugfix if the usleep() is present.
Diffstat (limited to 'stdio-common/printf_buffer_as_file.h')
0 files changed, 0 insertions, 0 deletions