[vlc-devel] [PATCH 1/2] thread: winstore: Do not discard a signaled object.

Rémi Denis-Courmont remi at remlab.net
Fri Nov 21 16:32:29 CET 2014

Le 2014-11-21 12:50, Hugo Beauzée-Luyssen a écrit :
> If the thread isn't cancellable, it would loop again until the 
> condition
> is actually signaled, however that seems like an expected behavior to
> me.

That is desirable but not required. The only strict requirement is to 
return zero from vlc_cond_timedwait() if the deadline is not reached.

> The problem here is that we override the wait condition signaling.
> Actually the issue could be that we are enforcing looping on spurious
> wakeups, while this might be more of a caller's responsibility, just
> like it's done using pthread.
> I'm not sure sure I understand what you mean by the msleep part?

Consider these cases for a cancelled but not cancellable thread:

1) msleep()/mwait()
-> should return when the timeout is reached.
2) vlc_cond_timedwait() if the variable is *not* signaled
-> should return ETIMEDOUT when the timeout is reached.
3) vlc_cond_timedwait() if the variable *is* signaled
-> should return 0.
4) vlc_cond_wait()
-> should return (assuming the variable is signaled).

I believe your patch addresses the last two cases, but leaves the first 
two broken.

Rémi Denis-Courmont

More information about the vlc-devel mailing list