]> sourceware.org Git - glibc.git/commit
nptl: Use all of g1_start and g_signals
authorMalte Skarupke <malteskarupke@fastmail.fm>
Wed, 4 Dec 2024 13:05:40 +0000 (08:05 -0500)
committerCarlos O'Donell <carlos@redhat.com>
Fri, 17 Jan 2025 19:56:58 +0000 (14:56 -0500)
commit91bb902f58264a2fd50fbce8f39a9a290dd23706
tree908d07252271d0325dbbceebd40ae67d104aaddc
parent4b79e27a5073c02f6bff9aa8f4791230a0ab1867
nptl: Use all of g1_start and g_signals

The LSB of g_signals was unused. The LSB of g1_start was used to indicate
which group is G2. This was used to always go to sleep in pthread_cond_wait
if a waiter is in G2. A comment earlier in the file says that this is not
correct to do:

 "Waiters cannot determine whether they are currently in G2 or G1 -- but they
  do not have to because all they are interested in is whether there are
  available signals"

I either would have had to update the comment, or get rid of the check. I
chose to get rid of the check. In fact I don't quite know why it was there.
There will never be available signals for group G2, so we didn't need the
special case. Even if there were, this would just be a spurious wake. This
might have caught some cases where the count has wrapped around, but it
wouldn't reliably do that, (and even if it did, why would you want to force a
sleep in that case?) and we don't support that many concurrent waiters
anyway. Getting rid of it allows us to use one more bit, making us more
robust to wraparound.

Signed-off-by: Malte Skarupke <malteskarupke@fastmail.fm>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
nptl/pthread_cond_broadcast.c
nptl/pthread_cond_common.c
nptl/pthread_cond_signal.c
nptl/pthread_cond_wait.c
This page took 0.041579 seconds and 5 git commands to generate.