Merge pull request #3775 from ErnestChen1/event_goto

[add] a macro to be isolated while using signals in rt_mutex_take fun…
This commit is contained in:
Bernard Xiong 2020-08-03 21:19:30 +08:00 committed by GitHub
commit 70142efbf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -690,7 +690,9 @@ rt_err_t rt_mutex_take(rt_mutex_t mutex, rt_int32_t time)
} }
else else
{ {
#ifdef RT_USING_SIGNALS
__again: __again:
#endif /* end of RT_USING_SIGNALS */
/* The value of mutex is 1 in initial status. Therefore, if the /* The value of mutex is 1 in initial status. Therefore, if the
* value is great than 0, it indicates the mutex is avaible. * value is great than 0, it indicates the mutex is avaible.
*/ */
@ -759,8 +761,10 @@ __again:
if (thread->error != RT_EOK) if (thread->error != RT_EOK)
{ {
#ifdef RT_USING_SIGNALS
/* interrupt by signal, try it again */ /* interrupt by signal, try it again */
if (thread->error == -RT_EINTR) goto __again; if (thread->error == -RT_EINTR) goto __again;
#endif /* end of RT_USING_SIGNALS */
/* return error */ /* return error */
return thread->error; return thread->error;