MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / signalProcess

Method signalProcess

source/kernel/kprocess.cpp:814–845  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

812}
813
814void 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
847void KProcess::signalIO(U32 code, S32 band, FD fd) {
848 memset(this->sigActions[K_SIGIO].sigInfo, 0, sizeof(this->sigActions[K_SIGIO].sigInfo));

Callers

nothing calls this directly

Calls 2

signalFdMethod · 0.95
runSignalsMethod · 0.80

Tested by

no test coverage detected