race test: fix out of memory problem for NUCLEO_F070RB

pull/5379/head
Maciej Bocianski 2017-10-25 09:40:05 +02:00
parent 1566395323
commit 9bf936cb49
1 changed files with 12 additions and 18 deletions

View File

@ -68,21 +68,18 @@ static void main_class_race()
void test_case_func_race()
{
Callback<void()> 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<void()> 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);