Merge pull request #5635 from c1728p9/fix_lazy_init

Protect local static object construction in ARMCC
pull/5693/head
Martin Kojtal 2017-12-12 17:41:21 +00:00 committed by GitHub
commit bea41d1ebb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -58,11 +58,13 @@ static SingletonPtr<TestClass> test_class;
static void main_func_race()
{
get_test_class();
TEST_ASSERT_EQUAL_UINT32(1, instance_count);
}
static void main_class_race()
{
test_class->do_something();
TEST_ASSERT_EQUAL_UINT32(1, instance_count);
}
void test_case_func_race()

View File

@ -977,6 +977,10 @@ extern "C" void __env_unlock( struct _reent *_r )
__rtos_env_unlock(_r);
}
#endif
#if defined (__GNUC__) || defined(__CC_ARM) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
#define CXA_GUARD_INIT_DONE (1 << 0)
#define CXA_GUARD_INIT_IN_PROGRESS (1 << 1)
#define CXA_GUARD_MASK (CXA_GUARD_INIT_DONE | CXA_GUARD_INIT_IN_PROGRESS)