C11’s thread interface was not very clear on failure conditions that some functions might encounter. It was not clear that wait functions for conditional variables (cnd_t
) and tentative locking of mutexes (mtx_t
) may fail spuriously, that is with not apparent reason for the caller. By lack of such a specification, it was not clear how C11 threads could be realized by POSIX threads, e.g.
Allowing spurious wakeups is particularly important for the wait functions, because it makes implementing the cnd_t
type much easier, in particular for the special case that the caller of cnd_signal
or cnd_broadcast
does not hold the lock on the corresponding mutex. On the other hand, from an application point of view this does not change much. Even without spurious wakeups, a thread that called `cnd_wait
`, e.g, must in any case check the real condition they are interested in.