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

Function sigqueue_dequeue

components/lwp/lwp_signal.c:277–311  ·  view source on GitHub ↗

* dequeue a siginfo matching the signo which is likely to be existed, and * test if any other siblings remains */

Source from the content-addressed store, hash-verified

275 * test if any other siblings remains
276 */
277static lwp_siginfo_t sigqueue_dequeue(lwp_sigqueue_t sigqueue, int signo)
278{
279 lwp_siginfo_t found;
280 lwp_siginfo_t candidate;
281 lwp_siginfo_t next;
282 rt_bool_t is_empty;
283
284 found = RT_NULL;
285 is_empty = RT_TRUE;
286 rt_list_for_each_entry_safe(candidate, next, &sigqueue->siginfo_list, node)
287 {
288 if (candidate->ksiginfo.signo == signo)
289 {
290 if (found)
291 {
292 /* already found */
293 is_empty = RT_FALSE;
294 break;
295 }
296 else
297 {
298 /* found first */
299 found = candidate;
300 rt_list_remove(&found->node);
301 }
302 }
303 else if (candidate->ksiginfo.signo > signo)
304 break;
305 }
306
307 if (found && is_empty)
308 _sigdelset(&sigqueue->sigset_pending, signo);
309
310 return found;
311}
312
313/**
314 * Discard all the signal matching `signo` in sigqueue

Callers 4

sigqueue_discardFunction · 0.85
sigqueue_discard_sigsetFunction · 0.85
lwp_thread_signal_catchFunction · 0.85
_dequeue_signalFunction · 0.85

Calls 2

rt_list_removeFunction · 0.85
_sigdelsetFunction · 0.85

Tested by

no test coverage detected