mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-01 01:31:26 +00:00
Less lame "concurrency" support
These APIs aren't thread safe, but they're pretending to be. Let's at least make the getter as fast as they can be. The setters are a lost cause unless the API can be fixed. llvm-svn: 152786
This commit is contained in:
parent
13e35c086c
commit
d6533ccd48
@ -103,7 +103,7 @@ set_unexpected(unexpected_handler func) _NOEXCEPT
|
||||
{
|
||||
if (func == 0)
|
||||
func = default_unexpected_handler;
|
||||
return __sync_lock_test_and_set(&__cxxabiapple::__cxa_unexpected_handler, func);
|
||||
return __sync_swap(&__cxxabiapple::__cxa_unexpected_handler, func);
|
||||
}
|
||||
|
||||
terminate_handler
|
||||
@ -111,7 +111,7 @@ set_terminate(terminate_handler func) _NOEXCEPT
|
||||
{
|
||||
if (func == 0)
|
||||
func = default_terminate_handler;
|
||||
return __sync_lock_test_and_set(&__cxxabiapple::__cxa_terminate_handler, func);
|
||||
return __sync_swap(&__cxxabiapple::__cxa_terminate_handler, func);
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -28,7 +28,7 @@ namespace std
|
||||
unexpected_handler
|
||||
get_unexpected() _NOEXCEPT
|
||||
{
|
||||
return __sync_fetch_and_add(&__cxxabiapple::__cxa_unexpected_handler, (unexpected_handler)0);
|
||||
return __cxxabiapple::__cxa_unexpected_handler;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"), noreturn))
|
||||
@ -50,7 +50,7 @@ unexpected()
|
||||
terminate_handler
|
||||
get_terminate() _NOEXCEPT
|
||||
{
|
||||
return __sync_fetch_and_add(&__cxxabiapple::__cxa_terminate_handler, (terminate_handler)0);
|
||||
return __cxxabiapple::__cxa_terminate_handler;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"), noreturn))
|
||||
@ -101,13 +101,13 @@ terminate() _NOEXCEPT
|
||||
new_handler
|
||||
set_new_handler(new_handler handler) _NOEXCEPT
|
||||
{
|
||||
return __sync_lock_test_and_set(&__cxxabiapple::__cxa_new_handler, handler);
|
||||
return __sync_swap(&__cxxabiapple::__cxa_new_handler, handler);
|
||||
}
|
||||
|
||||
new_handler
|
||||
get_new_handler() _NOEXCEPT
|
||||
{
|
||||
return __sync_fetch_and_add(&__cxxabiapple::__cxa_new_handler, (new_handler)0);
|
||||
return __cxxabiapple::__cxa_new_handler;
|
||||
}
|
||||
|
||||
} // std
|
||||
|
Loading…
Reference in New Issue
Block a user