Skip to content
  • Philippe Gerum's avatar
    lib/flags, lib/sem: add broadcast, disjunctive/conjunctive wait · 4918e512
    Philippe Gerum authored
    
    
    Applications were missing some features from semaphores and flags in
    order to make it easier to use them as building blocks of other
    synchronization mechanisms, which ABI 32 adds to address the issue. As
    a result, the API evolves as follows:
    
    - a semaphore may be broadcast using evl_flush_sem(), which is
      essentially a way to unblock all waiters atomically, returning with
      -EAGAIN to denote the condition.
    
    - evl_broadcast_flags() sends a given bit mask to all waiters
      present. This feature makes it simpler to implement gang-based logic
      in applications, when all members from a group of threads need to be
      notified atomically using a particular bit pattern (which a
      mutex+event combo does not allow easily).
    
    - evl_{timed_, try_}wait_some_flags() takes the set of bits to match
      in a disjunctive way (OR mode). Conversely, evl_{timed_,
      try_}wait_exact_flags() calls provide for conjunctive wait (AND
      mode). evl_{timed_, try_}wait_flags() have become wrappers to
      evl_{timed_, try_}wait_some_flags(), matching and consuming any bit
      set in the event flag group, which preserves their original
      semantics.
    
    Signed-off-by: default avatarPhilippe Gerum <rpm@xenomai.org>
    4918e512