* Send a signal to the targeted children (but NOT special children; * dead_end children are never signaled, either). */
| 4651 | * dead_end children are never signaled, either). |
| 4652 | */ |
| 4653 | static bool |
| 4654 | SignalSomeChildren(int signal, int target) |
| 4655 | { |
| 4656 | dlist_iter iter; |
| 4657 | bool signaled = false; |
| 4658 | |
| 4659 | dlist_foreach(iter, &BackendList) |
| 4660 | { |
| 4661 | Backend *bp = dlist_container(Backend, elem, iter.cur); |
| 4662 | |
| 4663 | if (bp->dead_end) |
| 4664 | continue; |
| 4665 | |
| 4666 | /* |
| 4667 | * Since target == BACKEND_TYPE_ALL is the most common case, we test |
| 4668 | * it first and avoid touching shared memory for every child. |
| 4669 | */ |
| 4670 | if (target != BACKEND_TYPE_ALL) |
| 4671 | { |
| 4672 | /* |
| 4673 | * Assign bkend_type for any recently announced WAL Sender |
| 4674 | * processes. |
| 4675 | */ |
| 4676 | if (bp->bkend_type == BACKEND_TYPE_NORMAL && |
| 4677 | IsPostmasterChildWalSender(bp->child_slot)) |
| 4678 | bp->bkend_type = BACKEND_TYPE_WALSND; |
| 4679 | |
| 4680 | if (!(target & bp->bkend_type)) |
| 4681 | continue; |
| 4682 | } |
| 4683 | |
| 4684 | ereport(DEBUG4, |
| 4685 | (errmsg_internal("sending signal %d to process %d", |
| 4686 | signal, (int) bp->pid))); |
| 4687 | signal_child(bp->pid, signal); |
| 4688 | signaled = true; |
| 4689 | } |
| 4690 | return signaled; |
| 4691 | } |
| 4692 | |
| 4693 | /* |
| 4694 | * Send a termination signal to children. This considers all of our children |
no test coverage detected