Merge pull request #5379 from maciejbocianski/race_mem_fix

race test: fix out of memory problem for NUCLEO_F070RB
pull/5417/merge
Jimmy Brisson 2017-11-01 14:05:58 -05:00 committed by GitHub
commit c7b4c7a7ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);