From 69e905c854d301b0cbc0723a6fd232b2b3bc6e35 Mon Sep 17 00:00:00 2001 From: Thomas Pfaff Date: Fri, 12 Jan 2001 01:23:46 +0000 Subject: [PATCH] gthr-win32.h (__gthread_objc_thread_get_data): Save and restore Win32 LastError. * gthr-win32.h (__gthread_objc_thread_get_data): Save and restore Win32 LastError. (__gthread_getspecific): Ditto. From-SVN: r38932 --- gcc/ChangeLog | 6 ++++++ gcc/gthr-win32.h | 22 ++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a04f1355eb8..0a3c2e64d87 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2001-01-10 Thomas Pfaff + + * gthr-win32.h (__gthread_objc_thread_get_data): Save and restore Win32 + LastError. + (__gthread_getspecific): Ditto. + Fri Jan 12 00:04:00 MET 2001 Jan Hubicka * i386.c (ix86_comparison_operator, fcmov_comparison_operator, diff --git a/gcc/gthr-win32.h b/gcc/gthr-win32.h index 119cbc7d9b9..dbe5e5b4f34 100644 --- a/gcc/gthr-win32.h +++ b/gcc/gthr-win32.h @@ -204,7 +204,16 @@ __gthread_objc_thread_set_data(void *value) void * __gthread_objc_thread_get_data(void) { - return TlsGetValue(__gthread_objc_data_tls); /* Return thread data. */ + DWORD lasterror; + void *ptr; + + lasterror = GetLastError(); + + ptr = TlsGetValue(__gthread_objc_data_tls); /* Return thread data. */ + + SetLastError( lasterror ); + + return ptr; } /* Backend mutex functions */ @@ -413,7 +422,16 @@ __gthread_key_delete (__gthread_key_t key) static inline void * __gthread_getspecific (__gthread_key_t key) { - return TlsGetValue (key); + DWORD lasterror; + void *ptr; + + lasterror = GetLastError(); + + ptr = TlsGetValue(key); + + SetLastError( lasterror ); + + return ptr; } static inline int