MCPcopy Create free account
hub / github.com/apache/nuttx / work_queue_next_wq

Function work_queue_next_wq

sched/wqueue/kwork_queue.c:70–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68 ****************************************************************************/
69
70int work_queue_next_wq(FAR struct kwork_wqueue_s *wqueue,
71 FAR struct work_s *work, worker_t worker,
72 FAR void *arg, clock_t delay)
73{
74 irqstate_t flags;
75
76 if (wqueue == NULL || work == NULL || worker == NULL ||
77 delay > WDOG_MAX_DELAY)
78 {
79 return -EINVAL;
80 }
81
82 /* Initialize the work structure. */
83
84 work->worker = worker; /* Work callback. non-NULL means queued */
85 work->arg = arg; /* Callback argument */
86 work->qtime += delay; /* Expected time based on last expiration time */
87
88 flags = spin_lock_irqsave(&wqueue->lock);
89
90 if (delay)
91 {
92 /* Insert to the pending list of the wqueue. */
93
94 if (work_insert_pending(wqueue, work))
95 {
96 /* Start the timer if the work is the earliest expired work. */
97
98 wd_start_abstick(&wqueue->timer, work->qtime,
99 work_timer_expired, (wdparm_t)wqueue);
100 }
101 }
102 else
103 {
104 /* Insert to the expired list of the wqueue. */
105
106 list_add_tail(&wqueue->expired, &work->node);
107 }
108
109 spin_unlock_irqrestore(&wqueue->lock, flags);
110
111 if (!delay)
112 {
113 /* Immediately wake up the worker thread. */
114
115 nxsem_post(&wqueue->sem);
116 }
117
118 return 0;
119}
120
121int work_queue_next(int qid, FAR struct work_s *work, worker_t worker,
122 FAR void *arg, clock_t delay)

Callers 10

sim_rptun_workFunction · 0.85
sim_usbhost_workFunction · 0.85
sim_usbdev_workFunction · 0.85
sim_netdev_workFunction · 0.85
sim_rpmsg_virtio_workFunction · 0.85
sim_x11event_workFunction · 0.85
sim_x11update_workFunction · 0.85
sim_usrsock_workFunction · 0.85
sim_audio_workFunction · 0.85
work_queue_nextFunction · 0.85

Calls 5

work_insert_pendingFunction · 0.85
wd_start_abstickFunction · 0.85
list_add_tailFunction · 0.85
spin_unlock_irqrestoreFunction · 0.85
nxsem_postFunction · 0.85

Tested by

no test coverage detected