Hi

The condition variable implementation added in commit 806dd0472f56fd
seems to fall into the trap(s) pointed out in the paper

  http://birrell.org/andrew/papers/ImplementingCVs.pdf

in particular, the "if no thread is currently waiting, signal should not
leave a full semaphore so a following _wait will just fall through".

Now, libgcc/gthr.h doesn't really spell out whether __gthread condition
variables are supposed to behave as POSIX condition variables, so I
don't know if it's a problem in practice.

Looking at the timedwait variant:

  __RETURN_ERRNO_IF_NOT_OK (semGive (*mutex));
  __RETURN_ERRNO_IF_NOT_OK (semTake (*cond, waiting_ticks));
  __RETURN_ERRNO_IF_NOT_OK (semTake (*mutex, WAIT_FOREVER));

isn't it a bug that the mutex is not re-acquired in case the wait times out?

Rasmus

Reply via email to