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

Ross Finlayson finlayson at live555.com
Wed Jun 24 23:57:22 CEST 2015

> The volatile keyword makes no difference for memory access rules in multiple threads.

Yes, but the only real concern in this particular case (because of the very limited way in which the shared ‘watch variable' is checked/set by multiple threads) is compiler optimization.  I.e., you’re concerned about a compiler ‘optimizing'

void foo(char* watchVariable) {
	while (1) {
		if (*watchVariable != 0) break;


void foo(char* watchVariable) {
	if (*watchVariable != 0) return;
	while (1) bar();

I don’t know of any compiler that would do this (because they seem to usually be quite conservative about the values of deferenced pointers), but I guess it’s possible.  So your point is well-taken; I should change the watch variable type to be “char volatile*”.

But again, this issue is moot wrt. VLC, so I apologize for the diversion :-)

Ross Finlayson
Live Networks, Inc.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20150624/6fb13ae7/attachment.html>

More information about the vlc-devel mailing list