[PATCH] [libcxxabi] On single threaded systems, turn mutexes into nops
Jon Roelofs
jonathan at codesourcery.com
Mon May 5 16:55:55 PDT 2014
================
Comment at: src/cxa_exception_storage.cpp:48
@@ +47,3 @@
+#if LIBCXXABI_SINGLE_THREADED
+ __cxa_eh_globals * eh_globals_ = NULL;
+#else
----------------
kledzik at apple.com wrote:
> Why is eh_globals_ being allocated with calloc() in the single threaded case?
>
> This would be much simpler to have a block (like the #if HAS_THREAD_LOCAL) that just has:
>
> #elif LIBCXXABI_SINGLE_THREADED
> static __cxa_eh_globals eh_globals;
> __cxa_eh_globals *_cxa_get_globals() { return &eh_globals; }
> __cxa_eh_globals *_cxa_get_globals_fast() { return &eh_globals; }
> #else
>
> and the rest of the file stays the same.
There's a comment above __cxa_get_globals_fast() saying that it has to return 0 if __cxa_get_globals() wasn't called first (which might be a bug in the HAS_THREAD_LOCAL side?).
Good point though, structuring it like that will make it cleaner.
http://reviews.llvm.org/D3386
More information about the cfe-commits
mailing list