[vlc-devel] [PATCH] Handle GET_PARAMETER keepalive responses during PAUSE

Rémi Denis-Courmont remi at remlab.net
Wed Jun 24 23:37:59 CEST 2015


Le mercredi 24 juin 2015, 14:21:42 Ross Finlayson a écrit :
> > 2) The variable is read/write for the thread calling doEventLoop() and not
> > accessed by any other thread (at least while doEventLoop() executes). This
> > is what I meant: the variable can only be set from a callback in the
> > event loop.
> No, the intent is allow the ‘watch variable’ to be set (to a non-zero
> value) by an external thread.

Who cares about your intent? The code is currently written in such a way that 
it behaves the way I described. That might not be what you intended when you 
wrote it, but the compiler does not care about your intentions.

> (If you do this, but are still concerned, then you may wish to declare
> the variable “volatile”.)

The volatile keyword makes no difference for memory access rules in multiple 
threads. Neither in ISO, nor in POSIX, nor in GCC (see "C Implementation-
defined behavior", "Qualifiers implementation" in gcc-doc).

-- 
Rémi Denis-Courmont
http://www.remlab.net/




More information about the vlc-devel mailing list