| 734 | } |
| 735 | |
| 736 | void lwp_thread_signal_catch(void *exp_frame) |
| 737 | { |
| 738 | struct rt_thread *thread; |
| 739 | struct rt_lwp *lwp; |
| 740 | lwp_sigqueue_t pending; |
| 741 | lwp_sigset_t *sig_mask; |
| 742 | int retry_signal_catch; |
| 743 | int signo; |
| 744 | |
| 745 | thread = rt_thread_self(); |
| 746 | lwp = (struct rt_lwp *)thread->lwp; |
| 747 | |
| 748 | RT_ASSERT(!!lwp); |
| 749 | LWP_LOCK(lwp); |
| 750 | |
| 751 | do { |
| 752 | /* if stopped process resume, we will retry to catch the signal */ |
| 753 | retry_signal_catch = 0; |
| 754 | signo = 0; |
| 755 | |
| 756 | /* try to peek a signal which is pending and not blocked by this thread */ |
| 757 | if (!sigqueue_isempty(_SIGQ(thread))) |
| 758 | { |
| 759 | pending = _SIGQ(thread); |
| 760 | sig_mask = &thread->signal.sigset_mask; |
| 761 | signo = sigqueue_peek(pending, sig_mask); |
| 762 | } |
| 763 | if (!signo && !sigqueue_isempty(_SIGQ(lwp))) |
| 764 | { |
| 765 | pending = _SIGQ(lwp); |
| 766 | sig_mask = &thread->signal.sigset_mask; |
| 767 | signo = sigqueue_peek(pending, sig_mask); |
| 768 | } |
| 769 | |
| 770 | if (signo) |
| 771 | { |
| 772 | lwp_siginfo_t siginfo; |
| 773 | lwp_sighandler_t handler; |
| 774 | |
| 775 | LOG_D("%s(signo=%d)", __func__, signo); |
| 776 | |
| 777 | siginfo = sigqueue_dequeue(pending, signo); |
| 778 | RT_ASSERT(siginfo != RT_NULL); |
| 779 | handler = _get_sighandler_locked(lwp, signo); |
| 780 | |
| 781 | if (_is_stop_signal(lwp, signo) && handler == LWP_SIG_ACT_DFL) |
| 782 | { |
| 783 | /* notify the status update for parent process */ |
| 784 | _notify_parent_and_leader(lwp, thread, signo, RT_TRUE); |
| 785 | |
| 786 | LOG_D("%s: pid=%d stopped", __func__, lwp->pid); |
| 787 | _stop_thread_locked(lwp, thread, signo, siginfo, pending); |
| 788 | LOG_D("%s: pid=%d continued", __func__, lwp->pid); |
| 789 | |
| 790 | /* wakeup and retry to catch signals send to us */ |
| 791 | retry_signal_catch = 1; |
| 792 | } |
| 793 | else |
nothing calls this directly
no test coverage detected