[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: nptl 0.26

> I do think the same optim can be done in pthread_cond_signal() and
> pthread_cond_broadcast().

pthread_cond_signal() must be called with the lock held since we wake
exactly one thread waiting on the futex and this must be one which can
actually receive the signal.  If the lock wouldn't be held this might
not be the case.

pthread_cond_broadcast() actually can drop the lock early since all
waiters are woken.

> By the way, why are you using 64 bits sequence number ? They can be 32 bits
> if comparisons are carefully done.

There is no careful or not in a plain comparison of larger or not.  And
this is required.

> sys_futex() uses 32 bits integer, and it is *impossible* to think 2^31
> threads could be used in a threaded application on ia32 ...

That's unrelated.  The 64 bit values are no counters but sequence
values.  And they have to be strictly monotonic.

--------------.                        ,-.            444 Castro Street
Ulrich Drepper \    ,-----------------'   \ Mountain View, CA 94041 USA
Red Hat         `--' drepper at redhat.com `---------------------------

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]