MCPcopy Create free account
hub / github.com/davmac314/dinit / pull_signal

Method pull_signal

dasynq/include/dasynq/kqueue.h:260–292  ·  view source on GitHub ↗

Pull a signal from pending, and report it, until it is no longer pending or the watch should be disabled. Call with lock held. Returns: true if watcher should be enabled, false if disabled.

Source from the content-addressed store, hash-verified

258 // should be disabled. Call with lock held.
259 // Returns: true if watcher should be enabled, false if disabled.
260 bool pull_signal(int signo, void *userdata)
261 {
262 bool enable_filt = true;
263 sigdata_t siginfo;
264
265#if _POSIX_REALTIME_SIGNALS > 0
266 struct timespec timeout = {0, 0};
267 sigset_t sigw_mask;
268 sigemptyset(&sigw_mask);
269 sigaddset(&sigw_mask, signo);
270 int rsigno = sigtimedwait(&sigw_mask, &siginfo.info, &timeout);
271 while (rsigno > 0) {
272 if (Base::receive_signal(*this, siginfo, userdata)) {
273 enable_filt = false;
274 break;
275 }
276 rsigno = sigtimedwait(&sigw_mask, &siginfo.info, &timeout);
277 }
278#else
279 // we have no sigtimedwait.
280 sigset_t pending_sigs;
281 sigpending(&pending_sigs);
282 while (sigismember(&pending_sigs, signo)) {
283 dprivate::dkqueue::get_siginfo(signo, &siginfo.info);
284 if (Base::receive_signal(*this, siginfo, userdata)) {
285 enable_filt = false;
286 break;
287 }
288 sigpending(&pending_sigs);
289 }
290#endif
291 return enable_filt;
292 }
293
294 public:
295

Callers

nothing calls this directly

Calls 1

get_siginfoFunction · 0.70

Tested by

no test coverage detected