From 3c4d8f65896253a82e19adcbe2808a863a99f74f Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Thu, 15 Mar 2018 12:53:56 +0100 Subject: Properly protect player struct with mutex The volatile keyword neither guarantees atomic access nor memory visibility[1]. Although this is usually not a problem on x86, it is incorrect to rely on this. Use mutex locks to protect all shared player variables and enforce memory visibility. [1] https://wiki.sei.cmu.edu/confluence/display/c/CON02-C.+Do+not+use+volatile+as+a+synchronization+primitive --- src/ui.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui.h') diff --git a/src/ui.h b/src/ui.h index 9081b71..da6bd8e 100644 --- a/src/ui.h +++ b/src/ui.h @@ -1,5 +1,5 @@ /* -Copyright (c) 2008-2011 +Copyright (c) 2008-2018 Lars-Dominik Braun Permission is hereby granted, free of charge, to any person obtaining a copy @@ -48,7 +48,7 @@ void BarUiPrintSong (const BarSettings_t *, const PianoSong_t *, size_t BarUiListSongs (const BarApp_t * const app, const PianoSong_t *song, const char *filter); void BarUiStartEventCmd (const BarSettings_t *, const char *, - const PianoStation_t *, const PianoSong_t *, const player_t *, + const PianoStation_t *, const PianoSong_t *, player_t *, PianoStation_t *, PianoReturn_t, CURLcode); bool BarUiPianoCall (BarApp_t * const, const PianoRequestType_t, void *, PianoReturn_t *, CURLcode *); -- cgit v1.2.3