News for hackers. Stuff that matters.
Re:Implementing Queues for Event-Driven Programs by scott_s on Monday June 13, 2016 @11:11AM (#11894468)
Pthreads on Linux encourage holding the lock during a signal or broadcast (http://linux.die.net/man/3/pthread_cond_signal):

  The pthread_cond_broadcast() or pthread_cond_signal()
  functions may be called by a thread whether or not it
  currently owns the mutex that threads calling
  pthread_cond_wait() or pthread_cond_timedwait() have
  associated with the condition variable during their waits;
  however, if predictable scheduling behavior is required,
  then that mutex shall be locked by the thread calling
  pthread_cond_broadcast() or pthread_cond_signal().
They don't define what exactly "predictable scheduling is", but the message that most programmers will probably come away with is, grabbing the lock is probably the better thing to do.

There are no comments on this comment yet.