LINUX.ORG.RU

История изменений

Исправление mittorn, (текущая версия) :

FUTEX_WAKE (since Linux 2.6.0)
              This operation wakes at most val of the waiters that are
              waiting (e.g., inside FUTEX_WAIT) on the futex word at the
              address uaddr.  Most commonly, val is specified as either
              1 (wake up a single waiter) or INT_MAX (wake up all
              waiters).  No guarantee is provided about which waiters
              are awoken (e.g., a waiter with a higher scheduling
              priority is not guaranteed to be awoken in preference to a
              waiter with a lower priority).


Тут пример есть:
https://habibutsu.github.io/synchronize.html

Интересно, конечно, есть ли какие-то альтернативы в pthread. Но всё что я видел помимо фьютекса пробуждает потоки по одному

P.S
Возможно, это оно:
https://stackoverflow.com/questions/40126442/best-way-to-wakeup-multiple-thre...

Исправление mittorn, :

FUTEX_WAKE (since Linux 2.6.0)
              This operation wakes at most val of the waiters that are
              waiting (e.g., inside FUTEX_WAIT) on the futex word at the
              address uaddr.  Most commonly, val is specified as either
              1 (wake up a single waiter) or INT_MAX (wake up all
              waiters).  No guarantee is provided about which waiters
              are awoken (e.g., a waiter with a higher scheduling
              priority is not guaranteed to be awoken in preference to a
              waiter with a lower priority).


Тут пример есть:
https://habibutsu.github.io/synchronize.html

Интересно, конечно, есть ли какие-то альтернативы в pthread. Но всё что я видел помимо фьютекса пробуждает потоки по одному

Исправление mittorn, :

FUTEX_WAKE (since Linux 2.6.0)
              This operation wakes at most val of the waiters that are
              waiting (e.g., inside FUTEX_WAIT) on the futex word at the
              address uaddr.  Most commonly, val is specified as either
              1 (wake up a single waiter) or INT_MAX (wake up all
              waiters).  No guarantee is provided about which waiters
              are awoken (e.g., a waiter with a higher scheduling
              priority is not guaranteed to be awoken in preference to a
              waiter with a lower priority).


Интересно, конечно, есть ли какие-то альтернативы в pthread. Но всё что я видел помимо фьютекса пробуждает потоки по одному

Исходная версия mittorn, :

FUTEX_WAKE (since Linux 2.6.0)
              This operation wakes at most val of the waiters that are
              waiting (e.g., inside FUTEX_WAIT) on the futex word at the
              address uaddr.  Most commonly, val is specified as either
              1 (wake up a single waiter) or INT_MAX (wake up all
              waiters).  No guarantee is provided about which waiters
              are awoken (e.g., a waiter with a higher scheduling
              priority is not guaranteed to be awoken in preference to a
              waiter with a lower priority).