Fix Android warnings

This commit is contained in:
Vinnie Falco
2013-07-31 16:29:34 -07:00
parent 052aee8f97
commit 4c403643b5
4 changed files with 9 additions and 3 deletions

View File

@@ -58,10 +58,15 @@ struct CurrentThreadHolder : public SharedObject
static char currentThreadHolderLock [sizeof (SpinLock)]; // (statically initialised to zeros).
static SpinLock* castToSpinLockWithoutAliasingWarning (void* s)
{
return static_cast<SpinLock*> (s);
}
static CurrentThreadHolder::Ptr getCurrentThreadHolder()
{
static CurrentThreadHolder::Ptr currentThreadHolder;
SpinLock::ScopedLockType lock (*reinterpret_cast <SpinLock*> (currentThreadHolderLock));
SpinLock::ScopedLockType lock (*castToSpinLockWithoutAliasingWarning (currentThreadHolderLock));
if (currentThreadHolder == nullptr)
currentThreadHolder = new CurrentThreadHolder();