aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/getrandom-internal.h
diff options
context:
space:
mode:
authorMalte Skarupke <malteskarupke@fastmail.fm>2024-12-04 07:56:13 -0500
committerCarlos O'Donell <carlos@redhat.com>2025-01-17 14:56:58 -0500
commit4f7b051f8ee3feff1b53b27a906f245afaa9cee1 (patch)
tree1fc44b4ef01b9a323b2cadddee5065ae35d43838 /sysdeps/unix/sysv/linux/getrandom-internal.h
parentb42cc6af11062c260c7dfa91f1c89891366fed3e (diff)
downloadglibc-4f7b051f8ee3feff1b53b27a906f245afaa9cee1.zip
glibc-4f7b051f8ee3feff1b53b27a906f245afaa9cee1.tar.gz
glibc-4f7b051f8ee3feff1b53b27a906f245afaa9cee1.tar.bz2
nptl: Remove unnecessary quadruple check in pthread_cond_wait
pthread_cond_wait was checking whether it was in a closed group no less than four times. Checking once is enough. Here are the four checks: 1. While spin-waiting. This was dead code: maxspin is set to 0 and has been for years. 2. Before deciding to go to sleep, and before incrementing grefs: I kept this 3. After incrementing grefs. There is no reason to think that the group would close while we do an atomic increment. Obviously it could close at any point, but that doesn't mean we have to recheck after every step. This check was equally good as check 2, except it has to do more work. 4. When we find ourselves in a group that has a signal. We only get here after we check that we're not in a closed group. There is no need to check again. The check would only have helped in cases where the compare_exchange in the next line would also have failed. Relying on the compare_exchange is fine. Removing the duplicate checks clarifies the code. Signed-off-by: Malte Skarupke <malteskarupke@fastmail.fm> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'sysdeps/unix/sysv/linux/getrandom-internal.h')
0 files changed, 0 insertions, 0 deletions