* dequeue a siginfo matching the signo which is likely to be existed, and * test if any other siblings remains */
| 275 | * test if any other siblings remains |
| 276 | */ |
| 277 | static 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 |
no test coverage detected