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

Function channel_fops_poll

components/lwp/lwp_ipc.c:1012–1034  ·  view source on GitHub ↗

for fops */

Source from the content-addressed store, hash-verified

1010
1011/* for fops */
1012static int channel_fops_poll(struct dfs_file *file, struct rt_pollreq *req)
1013{
1014 int mask = POLLOUT;
1015 rt_channel_t ch;
1016 rt_base_t level;
1017
1018 ch = (rt_channel_t)file->vnode->data;
1019
1020 level = rt_spin_lock_irqsave(&ch->slock);
1021 rt_poll_add(&(ch->reader_queue), req);
1022 if (ch->stat != RT_IPC_STAT_IDLE)
1023 {
1024 rt_spin_unlock_irqrestore(&ch->slock, level);
1025 return mask;
1026 }
1027 if (!rt_list_isempty(&ch->wait_msg))
1028 {
1029 mask |= POLLIN;
1030 }
1031 rt_spin_unlock_irqrestore(&ch->slock, level);
1032
1033 return mask;
1034}
1035
1036static int channel_fops_close(struct dfs_file *file)
1037{

Callers

nothing calls this directly

Calls 4

rt_poll_addFunction · 0.85
rt_list_isemptyFunction · 0.85
rt_spin_lock_irqsaveFunction · 0.50

Tested by

no test coverage detected