[vlc-devel] commit: Win32: minor thread-safety fix ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Jan 30 19:35:43 CET 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jan 30 20:35:29 2010 +0200| [0203cf885a323d53a6309b4dc192256259b10ede] | committer: Rémi Denis-Courmont 

Win32: minor thread-safety fix

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0203cf885a323d53a6309b4dc192256259b10ede
---

 src/text/wincp.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/text/wincp.c b/src/text/wincp.c
index 66013c4..99ac42b 100644
--- a/src/text/wincp.c
+++ b/src/text/wincp.c
@@ -211,7 +211,9 @@ const char *GetFallbackEncoding( void )
     return FindFallbackEncoding (psz_lang);
 #else
     static char buf[16] = "";
+    static vlc_mutex_t lock = VLC_STATIC_MUTEX;
 
+    vlc_mutex_lock (&lock);
     if (buf[0] == 0)
     {
         int cp = GetACP ();
@@ -225,6 +227,7 @@ const char *GetFallbackEncoding( void )
                 snprintf (buf, sizeof (buf), "CP%u", cp);
         }
     }
+    vlc_mutex_unlock (&lock);
     return buf;
 #endif
 }




More information about the vlc-devel mailing list