From 9bf936cb492f2a0235a1ea56eada5f76ee753b96 Mon Sep 17 00:00:00 2001 From: Maciej Bocianski Date: Wed, 25 Oct 2017 09:40:05 +0200 Subject: [PATCH] race test: fix out of memory problem for NUCLEO_F070RB --- TESTS/mbed_drivers/race_test/main.cpp | 30 +++++++++++---------------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/TESTS/mbed_drivers/race_test/main.cpp b/TESTS/mbed_drivers/race_test/main.cpp index c0a89ff8c5..f4753f9bf4 100644 --- a/TESTS/mbed_drivers/race_test/main.cpp +++ b/TESTS/mbed_drivers/race_test/main.cpp @@ -68,21 +68,18 @@ static void main_class_race() void test_case_func_race() { Callback cb(main_func_race); - Thread *t1 = new Thread(osPriorityNormal, TEST_STACK_SIZE); - Thread *t2 = new Thread(osPriorityNormal, TEST_STACK_SIZE); + Thread t1(osPriorityNormal, TEST_STACK_SIZE); + Thread t2(osPriorityNormal, TEST_STACK_SIZE); // Start start first thread - t1->start(cb); + t1.start(cb); // Start second thread while the first is inside the constructor Thread::wait(250); - t2->start(cb); + t2.start(cb); // Wait for the threads to finish - t1->join(); - t2->join(); - - delete t1; - delete t2; + t1.join(); + t2.join(); TEST_ASSERT_EQUAL_UINT32(1, instance_count); @@ -93,21 +90,18 @@ void test_case_func_race() void test_case_class_race() { Callback cb(main_class_race); - Thread *t1 = new Thread(osPriorityNormal, TEST_STACK_SIZE); - Thread *t2 = new Thread(osPriorityNormal, TEST_STACK_SIZE); + Thread t1(osPriorityNormal, TEST_STACK_SIZE); + Thread t2(osPriorityNormal, TEST_STACK_SIZE); // Start start first thread - t1->start(cb); + t1.start(cb); // Start second thread while the first is inside the constructor Thread::wait(250); - t2->start(cb); + t2.start(cb); // Wait for the threads to finish - t1->join(); - t2->join(); - - delete t1; - delete t2; + t1.join(); + t2.join(); TEST_ASSERT_EQUAL_UINT32(1, instance_count);