summaryrefslogtreecommitdiff
path: root/src/ipc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipc.c')
-rw-r--r--src/ipc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ipc.c b/src/ipc.c
index d6c3717b9e..3a5a0efa61 100644
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -507,6 +507,9 @@ static rt_err_t _rt_sem_take(rt_sem_t sem, rt_int32_t timeout, int suspend_flag)
RT_OBJECT_HOOK_CALL(rt_object_trytake_hook, (&(sem->parent.parent)));
+ /* current context checking */
+ RT_DEBUG_SCHEDULER_AVAILABLE(sem->value == 0 && timeout != 0);
+
/* disable interrupt */
level = rt_hw_interrupt_disable();
@@ -534,9 +537,6 @@ static rt_err_t _rt_sem_take(rt_sem_t sem, rt_int32_t timeout, int suspend_flag)
}
else
{
- /* current context checking */
- RT_DEBUG_SCHEDULER_AVAILABLE(RT_TRUE);
-
/* semaphore is unavailable, push to suspend list */
/* get current thread */
thread = rt_thread_self();