Skip to content

Commit c573815

Browse files
committed
fix assertion error when thread wakeup while waiting mutex
1 parent 2598a9c commit c573815

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ipc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,13 +1450,13 @@ static rt_err_t _rt_mutex_take(rt_mutex_t mutex, rt_int32_t timeout, int suspend
14501450

14511451
rt_spin_lock(&(mutex->spinlock));
14521452

1453-
if (thread->error == RT_EOK)
1453+
if (mutex->owner == thread)
14541454
{
14551455
/**
14561456
* get mutex successfully
14571457
* Note: assert to avoid an unexpected resume
14581458
*/
1459-
RT_ASSERT(mutex->owner == thread);
1459+
RT_ASSERT(thread->error == RT_EOK);
14601460
}
14611461
else
14621462
{

0 commit comments

Comments
 (0)