| 812 | } |
| 813 | |
| 814 | void KProcess::signalProcess(U32 signal) { |
| 815 | U64 signalMask = ((U64)1 << (signal-1)); |
| 816 | { |
| 817 | BOXEDWINE_CRITICAL_SECTION_WITH_MUTEX(this->pendingSignalsMutex); |
| 818 | this->pendingSignals |= signalMask; |
| 819 | } |
| 820 | |
| 821 | #ifdef BOXEDWINE_MULTI_THREADED |
| 822 | // give each thread a chance to run a signal, some or all of them might have the signal masked off. |
| 823 | // In that case when the user unmasks the signal with sigprocmask it will be caught then |
| 824 | iterateThreads([](KThread* thread) { |
| 825 | if (thread->waitingCond) { |
| 826 | BOXEDWINE_CRITICAL_SECTION_WITH_MUTEX(thread->waitingCondSync); |
| 827 | if (thread->waitingCond) { |
| 828 | thread->runSignals(); |
| 829 | } |
| 830 | } |
| 831 | return true; |
| 832 | }); |
| 833 | #else |
| 834 | for (auto& t : this->threads) { |
| 835 | KThread* thread = t.value; |
| 836 | thread->runSignals(); |
| 837 | } |
| 838 | #endif |
| 839 | { |
| 840 | BOXEDWINE_CRITICAL_SECTION_WITH_MUTEX(this->pendingSignalsMutex); |
| 841 | if (this->pendingSignals & signalMask) { |
| 842 | this->signalFd(nullptr, signal); |
| 843 | } |
| 844 | } |
| 845 | } |
| 846 | |
| 847 | void KProcess::signalIO(U32 code, S32 band, FD fd) { |
| 848 | memset(this->sigActions[K_SIGIO].sigInfo, 0, sizeof(this->sigActions[K_SIGIO].sigInfo)); |
nothing calls this directly
no test coverage detected