libobs/util: Add atomic bool load functions
parent
ba7b53f330
commit
598ae383bc
|
@ -266,6 +266,11 @@ bool os_atomic_set_bool(volatile bool *ptr, bool val)
|
|||
return __sync_lock_test_and_set(ptr, val);
|
||||
}
|
||||
|
||||
bool os_atomic_load_bool(const volatile bool *ptr)
|
||||
{
|
||||
return __atomic_load_n(ptr, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
|
||||
void os_set_thread_name(const char *name)
|
||||
{
|
||||
#if defined(__APPLE__)
|
||||
|
|
|
@ -169,6 +169,11 @@ bool os_atomic_set_bool(volatile bool *ptr, bool val)
|
|||
return (bool)InterlockedExchange8((volatile char*)ptr, (char)val);
|
||||
}
|
||||
|
||||
bool os_atomic_load_bool(const volatile bool *ptr)
|
||||
{
|
||||
return (bool)InterlockedOr8((volatile char*)ptr, 0);
|
||||
}
|
||||
|
||||
#define VC_EXCEPTION 0x406D1388
|
||||
|
||||
#pragma pack(push,8)
|
||||
|
|
|
@ -77,6 +77,7 @@ EXPORT bool os_atomic_compare_swap_long(volatile long *val,
|
|||
long old_val, long new_val);
|
||||
|
||||
EXPORT bool os_atomic_set_bool(volatile bool *ptr, bool val);
|
||||
EXPORT bool os_atomic_load_bool(const volatile bool *ptr);
|
||||
|
||||
EXPORT void os_set_thread_name(const char *name);
|
||||
|
||||
|
|
Loading…
Reference in New Issue