Liste des Groupes | Revenir à cl c++ |
Am 11.09.2024 um 14:03 schrieb Muttley@dastardlyhq.com:
>What upper limit? The max number of threads allowed in the protected section>
above is 2, not 10. Or do you mean it'll only count up to 10 threads waiting
and ignore any beyond that? What happens if thread 11 comes along?
The static parmeter is the maximum counter and the the two is the
initial counter. So two threads can currently acquire that semaphore.
Condition variables IMO are unintuitive (eg the internal state change from>
waiting on condition variable to waiting on mutex is completely invisible)
and hence very prone to logical bugs. I tend to avoid them where possible.
If you have a producer-consumer-pattern condition variables are the most
efficient way to handle this pattern.
Les messages affichés proviennent d'usenet.