[vlc-commits] win32: do not clobber error status when touching thread variables
Rémi Denis-Courmont
git at videolan.org
Sun Jul 21 18:47:12 CEST 2013
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jul 21 19:14:56 2013 +0300| [013044c36169a4ef9974423a79432f2092281bf3] | committer: Rémi Denis-Courmont
win32: do not clobber error status when touching thread variables
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=013044c36169a4ef9974423a79432f2092281bf3
---
src/win32/thread.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/win32/thread.c b/src/win32/thread.c
index 45abc4e..d13ac08 100644
--- a/src/win32/thread.c
+++ b/src/win32/thread.c
@@ -358,12 +358,21 @@ void vlc_threadvar_delete (vlc_threadvar_t *p_tls)
int vlc_threadvar_set (vlc_threadvar_t key, void *value)
{
- return TlsSetValue (key->id, value) ? ENOMEM : 0;
+ int saved = GetLastError ();
+ int val = TlsSetValue (key->id, value) ? ENOMEM : 0;
+
+ if (val == 0)
+ SetLastError(saved);
+ return val;
}
void *vlc_threadvar_get (vlc_threadvar_t key)
{
- return TlsGetValue (key->id);
+ int saved = GetLastError ();
+ void *value = TlsGetValue (key->id);
+
+ SetLastError(saved);
+ return value;
}
/*** Threads ***/
More information about the vlc-commits
mailing list