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

Function timerfd_timeout

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

Source from the content-addressed store, hash-verified

299}
300
301static void timerfd_timeout(void *parameter)
302{
303 struct rt_timerfd *tfd = RT_NULL;
304
305 tfd = (struct rt_timerfd *)parameter;
306
307 if (tfd == RT_NULL)
308 {
309 return ;
310 }
311
312 rt_wqueue_wakeup(&tfd->timerfd_queue, (void *)POLLIN);
313
314 rt_atomic_store(&(tfd->ticks), 1);
315 rt_atomic_add(&(tfd->timeout_num), 1);
316
317 rt_mutex_take(&tfd->lock, RT_WAITING_FOREVER);
318
319 get_current_time(tfd, RT_NULL);
320 if (tfd->isperiodic == OPEN_PERIODIC)
321 {
322 if (tfd->timer)
323 {
324 rt_timer_stop(tfd->timer);
325 rt_timer_delete(tfd->timer);
326 tfd->timer = RT_NULL;
327 }
328 tfd->isperiodic = ENTER_PERIODIC;
329 tfd->timer = rt_timer_create(TIMERFD_MUTEX_NAME, timerfd_timeout,
330 tfd, tfd->tick_out,
331 RT_TIMER_FLAG_PERIODIC | RT_TIMER_FLAG_SOFT_TIMER);
332
333 if (tfd->timer == RT_NULL)
334 {
335 LOG_E("rt_timer_create fail \n");
336 rt_mutex_release(&tfd->lock);
337 return ;
338 }
339 rt_timer_start(tfd->timer);
340 }
341
342 rt_mutex_release(&tfd->lock);
343}
344
345static void timerfd_time_operation(time_t *sec, long *nsec)
346{

Callers 1

timerfd_do_settimeFunction · 0.85

Calls 8

rt_wqueue_wakeupFunction · 0.85
rt_mutex_takeFunction · 0.85
get_current_timeFunction · 0.85
rt_timer_stopFunction · 0.85
rt_timer_deleteFunction · 0.85
rt_timer_createFunction · 0.85
rt_mutex_releaseFunction · 0.85
rt_timer_startFunction · 0.85

Tested by

no test coverage detected