File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed
components/libc/posix/pthreads Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -367,30 +367,27 @@ rt_err_t _pthread_cond_timedwait(pthread_cond_t *cond,
367367 }
368368
369369 {
370- register rt_base_t temp ;
371370 struct rt_thread * thread ;
372371
373372 /* parameter check */
374373 RT_ASSERT (sem != RT_NULL );
375374 RT_ASSERT (rt_object_get_type (& sem -> parent .parent ) == RT_Object_Class_Semaphore );
376375
377- /* disable interrupt */
378- temp = rt_hw_interrupt_disable ();
376+ rt_enter_critical ();
379377
380378 if (sem -> value > 0 )
381379 {
382380 /* semaphore is available */
383381 sem -> value -- ;
384382
385- /* enable interrupt */
386- rt_hw_interrupt_enable (temp );
383+ rt_exit_critical ();
387384 }
388385 else
389386 {
390387 /* no waiting, return with timeout */
391388 if (time == 0 )
392389 {
393- rt_hw_interrupt_enable ( temp );
390+ rt_exit_critical ( );
394391
395392 return - RT_ETIMEOUT ;
396393 }
@@ -434,11 +431,8 @@ rt_err_t _pthread_cond_timedwait(pthread_cond_t *cond,
434431 return - RT_ERROR ;
435432 }
436433
437- /* enable interrupt */
438- rt_hw_interrupt_enable (temp );
439-
440- /* do schedule */
441- rt_schedule ();
434+ /* exit critical and do schedule */
435+ rt_exit_critical ();
442436
443437 result = thread -> error ;
444438
You can’t perform that action at this time.
0 commit comments