Skip to content

Commit bea41d1

Browse files
authored
Merge pull request #5635 from c1728p9/fix_lazy_init
Protect local static object construction in ARMCC
2 parents 5c98ca5 + c63a627 commit bea41d1

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

TESTS/mbed_drivers/race_test/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,13 @@ static SingletonPtr<TestClass> test_class;
5858
static void main_func_race()
5959
{
6060
get_test_class();
61+
TEST_ASSERT_EQUAL_UINT32(1, instance_count);
6162
}
6263

6364
static void main_class_race()
6465
{
6566
test_class->do_something();
67+
TEST_ASSERT_EQUAL_UINT32(1, instance_count);
6668
}
6769

6870
void test_case_func_race()

platform/mbed_retarget.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,10 @@ extern "C" void __env_unlock( struct _reent *_r )
977977
__rtos_env_unlock(_r);
978978
}
979979

980+
#endif
981+
982+
#if defined (__GNUC__) || defined(__CC_ARM) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
983+
980984
#define CXA_GUARD_INIT_DONE (1 << 0)
981985
#define CXA_GUARD_INIT_IN_PROGRESS (1 << 1)
982986
#define CXA_GUARD_MASK (CXA_GUARD_INIT_DONE | CXA_GUARD_INIT_IN_PROGRESS)

0 commit comments

Comments
 (0)