@@ -68,21 +68,18 @@ static void main_class_race()
68
68
void test_case_func_race ()
69
69
{
70
70
Callback<void ()> cb (main_func_race);
71
- Thread *t1 = new Thread (osPriorityNormal, TEST_STACK_SIZE);
72
- Thread *t2 = new Thread (osPriorityNormal, TEST_STACK_SIZE);
71
+ Thread t1 (osPriorityNormal, TEST_STACK_SIZE);
72
+ Thread t2 (osPriorityNormal, TEST_STACK_SIZE);
73
73
74
74
// Start start first thread
75
- t1-> start (cb);
75
+ t1. start (cb);
76
76
// Start second thread while the first is inside the constructor
77
77
Thread::wait (250 );
78
- t2-> start (cb);
78
+ t2. start (cb);
79
79
80
80
// Wait for the threads to finish
81
- t1->join ();
82
- t2->join ();
83
-
84
- delete t1;
85
- delete t2;
81
+ t1.join ();
82
+ t2.join ();
86
83
87
84
TEST_ASSERT_EQUAL_UINT32 (1 , instance_count);
88
85
@@ -93,21 +90,18 @@ void test_case_func_race()
93
90
void test_case_class_race ()
94
91
{
95
92
Callback<void ()> cb (main_class_race);
96
- Thread *t1 = new Thread (osPriorityNormal, TEST_STACK_SIZE);
97
- Thread *t2 = new Thread (osPriorityNormal, TEST_STACK_SIZE);
93
+ Thread t1 (osPriorityNormal, TEST_STACK_SIZE);
94
+ Thread t2 (osPriorityNormal, TEST_STACK_SIZE);
98
95
99
96
// Start start first thread
100
- t1-> start (cb);
97
+ t1. start (cb);
101
98
// Start second thread while the first is inside the constructor
102
99
Thread::wait (250 );
103
- t2-> start (cb);
100
+ t2. start (cb);
104
101
105
102
// Wait for the threads to finish
106
- t1->join ();
107
- t2->join ();
108
-
109
- delete t1;
110
- delete t2;
103
+ t1.join ();
104
+ t2.join ();
111
105
112
106
TEST_ASSERT_EQUAL_UINT32 (1 , instance_count);
113
107
0 commit comments