native_tls_get()
' should not check results
caller should check the result of `native_tls_get()`.
This commit is contained in:
parent
9c9c217045
commit
741ac50330
Notes:
git
2022-05-24 10:07:24 +09:00
@ -102,11 +102,8 @@ typedef pthread_key_t native_tls_key_t;
|
|||||||
static inline void *
|
static inline void *
|
||||||
native_tls_get(native_tls_key_t key)
|
native_tls_get(native_tls_key_t key)
|
||||||
{
|
{
|
||||||
void *ptr = pthread_getspecific(key);
|
// return value should be checked by caller
|
||||||
if (UNLIKELY(ptr == NULL)) {
|
return pthread_getspecific(key);
|
||||||
rb_bug("pthread_getspecific returns NULL");
|
|
||||||
}
|
|
||||||
return ptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
@ -44,11 +44,8 @@ typedef DWORD native_tls_key_t; // TLS index
|
|||||||
static inline void *
|
static inline void *
|
||||||
native_tls_get(native_tls_key_t key)
|
native_tls_get(native_tls_key_t key)
|
||||||
{
|
{
|
||||||
void *ptr = TlsGetValue(key);
|
// return value should be checked by caller.
|
||||||
if (UNLIKELY(ptr == NULL)) {
|
return TlsGetValue(key);
|
||||||
rb_bug("TlsGetValue() returns NULL");
|
|
||||||
}
|
|
||||||
return ptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user