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

Function timerfd_poll

components/libc/posix/io/timerfd/timerfd.c:95–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95static int timerfd_poll(struct dfs_file *file, struct rt_pollreq *req)
96{
97 struct rt_timerfd *tfd;
98 int events = 0;
99
100 tfd = file->vnode->data;
101
102 rt_mutex_take(&tfd->lock, RT_WAITING_FOREVER);
103
104 rt_poll_add(&tfd->timerfd_queue, req);
105
106 rt_mutex_release(&tfd->lock);
107
108 if (rt_atomic_load(&(tfd->ticks)) > 0)
109 {
110 events |= POLLIN;
111 }
112
113 return events;
114}
115
116#ifndef RT_USING_DFS_V2
117static ssize_t timerfd_read(struct dfs_file *file, void *buf, size_t count)

Callers

nothing calls this directly

Calls 3

rt_mutex_takeFunction · 0.85
rt_poll_addFunction · 0.85
rt_mutex_releaseFunction · 0.85

Tested by

no test coverage detected