mirror of
https://github.com/gperftools/gperftools
synced 2025-01-18 04:41:34 +00:00
Make sure we don't clobber GetLastError() (for windows).
git-svn-id: http://gperftools.googlecode.com/svn/trunk@71 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
This commit is contained in:
parent
a63235c433
commit
1894763f57
@ -103,8 +103,12 @@ enum { PTHREAD_ONCE_INIT = 0 }; // important that this be 0! for SpinLock
|
||||
extern pthread_key_t PthreadKeyCreate(void (*destr_fn)(void*)); // in port.cc
|
||||
#define perftools_pthread_key_create(pkey, destr_fn) \
|
||||
*(pkey) = PthreadKeyCreate(destr_fn)
|
||||
#define perftools_pthread_getspecific(key) \
|
||||
TlsGetValue(key)
|
||||
inline void* perftools_pthread_getspecific(DWORD key) {
|
||||
DWORD err = GetLastError();
|
||||
void* rv = TlsGetValue(key);
|
||||
if (err) SetLastError(err);
|
||||
return rv;
|
||||
}
|
||||
#define perftools_pthread_setspecific(key, val) \
|
||||
TlsSetValue((key), (val))
|
||||
// NOTE: this is Win98 and later. For Win95 we could use a CRITICAL_SECTION...
|
||||
|
Loading…
Reference in New Issue
Block a user