@@ -48,9 +48,9 @@ volatile bool mutex_defect = false;
48
48
bool manipulate_protected_zone (const int thread_delay)
49
49
{
50
50
bool result = true ;
51
+ osStatus stat;
51
52
52
- osStatus stat = stdio_mutex.lock ();
53
- TEST_ASSERT_EQUAL (osOK, stat);
53
+ stdio_mutex.lock ();
54
54
55
55
core_util_critical_section_enter ();
56
56
if (changing_counter == true ) {
@@ -118,8 +118,8 @@ void test_multiple_threads(void)
118
118
119
119
void test_dual_thread_nolock_lock_thread (Mutex *mutex)
120
120
{
121
- osStatus stat = mutex-> lock (osWaitForever) ;
122
- TEST_ASSERT_EQUAL (osOK, stat );
121
+ osStatus stat;
122
+ mutex-> lock ( );
123
123
124
124
stat = mutex->unlock ();
125
125
TEST_ASSERT_EQUAL (osOK, stat);
@@ -161,8 +161,7 @@ void test_dual_thread_nolock(void)
161
161
162
162
void test_dual_thread_lock_unlock_thread (Mutex *mutex)
163
163
{
164
- osStatus stat = mutex->lock (osWaitForever);
165
- TEST_ASSERT_EQUAL (osOK, stat);
164
+ mutex->lock ();
166
165
}
167
166
168
167
/* * Test dual thread lock unlock
@@ -180,8 +179,7 @@ void test_dual_thread_lock_unlock(void)
180
179
osStatus stat;
181
180
Thread thread (osPriorityNormal, TEST_STACK_SIZE);
182
181
183
- stat = mutex.lock ();
184
- TEST_ASSERT_EQUAL (osOK, stat);
182
+ mutex.lock ();
185
183
186
184
thread.start (callback (test_dual_thread_lock_unlock_thread, &mutex));
187
185
@@ -202,9 +200,9 @@ void test_dual_thread_lock_lock_thread(Mutex *mutex)
202
200
Timer timer;
203
201
timer.start ();
204
202
205
- osStatus stat = mutex->lock (TEST_DELAY);
206
- TEST_ASSERT_EQUAL (osErrorTimeout , stat);
207
- TEST_ASSERT_UINT32_WITHIN (5000 , TEST_DELAY * 1000 , timer.read_us ());
203
+ bool stat = mutex->trylock_for (TEST_DELAY);
204
+ TEST_ASSERT_EQUAL (false , stat);
205
+ TEST_ASSERT_UINT32_WITHIN (5000 , TEST_DELAY* 1000 , timer.read_us ());
208
206
}
209
207
210
208
/* * Test dual thread lock
@@ -228,8 +226,7 @@ void test_dual_thread_lock(void)
228
226
osStatus stat;
229
227
Thread thread (osPriorityNormal, TEST_STACK_SIZE);
230
228
231
- stat = mutex.lock ();
232
- TEST_ASSERT_EQUAL (osOK, stat);
229
+ mutex.lock ();
233
230
234
231
thread.start (callback (F, &mutex));
235
232
@@ -250,11 +247,9 @@ void test_single_thread_lock_recursive(void)
250
247
Mutex mutex;
251
248
osStatus stat;
252
249
253
- stat = mutex.lock ();
254
- TEST_ASSERT_EQUAL (osOK, stat);
250
+ mutex.lock ();
255
251
256
- stat = mutex.lock ();
257
- TEST_ASSERT_EQUAL (osOK, stat);
252
+ mutex.lock ();
258
253
259
254
stat = mutex.unlock ();
260
255
TEST_ASSERT_EQUAL (osOK, stat);
@@ -291,8 +286,7 @@ void test_single_thread_lock(void)
291
286
Mutex mutex;
292
287
osStatus stat;
293
288
294
- stat = mutex.lock ();
295
- TEST_ASSERT_EQUAL (osOK, stat);
289
+ mutex.lock ();
296
290
297
291
stat = mutex.unlock ();
298
292
TEST_ASSERT_EQUAL (osOK, stat);
0 commit comments