MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / wakeup_sender_wait_recv

Function wakeup_sender_wait_recv

components/lwp/lwp_ipc.c:317–347  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

315}
316
317static rt_err_t wakeup_sender_wait_recv(void *object, struct rt_thread *thread)
318{
319 rt_channel_t ch;
320
321 ch = (rt_channel_t)object;
322 if (ch->stat == RT_IPC_STAT_ACTIVE && ch->reply == thread)
323 {
324 ch->stat = RT_IPC_STAT_IDLE;
325 ch->reply = RT_NULL;
326 }
327 else
328 {
329 rt_ipc_msg_t msg;
330 rt_list_t *l;
331
332 l = ch->wait_msg.next;
333 while (l != &ch->wait_msg)
334 {
335 msg = rt_list_entry(l, struct rt_ipc_msg, mlist);
336 if (msg->need_reply && msg->msg.sender == thread)
337 {
338 rt_list_remove(&msg->mlist); /* remove the msg from the channel */
339 _ipc_msg_free(msg);
340 break;
341 }
342 l = l->next;
343 }
344 }
345 thread->error = -RT_EINTR;
346 return rt_thread_resume(thread); /* wake up the sender */
347}
348
349static rt_err_t wakeup_sender_wait_reply(void *object, struct rt_thread *thread)
350{

Callers

nothing calls this directly

Calls 3

rt_list_removeFunction · 0.85
_ipc_msg_freeFunction · 0.85
rt_thread_resumeFunction · 0.85

Tested by

no test coverage detected