Skip to content

Commit

Permalink
[kernel]支持多个线程接收同一个事件
Browse files Browse the repository at this point in the history
  • Loading branch information
Rbb666 authored and Guozhanxin committed Jul 7, 2023
1 parent b59d243 commit 67b38d1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1770,6 +1770,7 @@ rt_err_t rt_event_send(rt_event_t event, rt_uint32_t set)
rt_base_t level;
rt_base_t status;
rt_bool_t need_schedule;
rt_uint32_t need_clear_set = 0;

/* parameter check */
RT_ASSERT(event != RT_NULL);
Expand Down Expand Up @@ -1833,7 +1834,7 @@ rt_err_t rt_event_send(rt_event_t event, rt_uint32_t set)
{
/* clear event */
if (thread->event_info & RT_EVENT_FLAG_CLEAR)
event->set &= ~thread->event_set;
need_clear_set |= thread->event_set;

/* resume thread, and thread list breaks out */
rt_thread_resume(thread);
Expand All @@ -1843,6 +1844,10 @@ rt_err_t rt_event_send(rt_event_t event, rt_uint32_t set)
need_schedule = RT_TRUE;
}
}
if (need_clear_set)
{
event->set &= ~need_clear_set;
}
}

/* enable interrupt */
Expand Down

0 comments on commit 67b38d1

Please sign in to comment.