def test_masked(self): oldmask = signal_mask.mask_all() TestSignalMask.signal_received = False os.kill(0, signal.SIGUSR1) self.assertFalse(TestSignalMask.signal_received) signal_mask.unmask_all(oldmask)
def Popen(args, **kwargs): orig_preexec_fn = kwargs.get('preexec_fn') oldmask = signal_mask.mask_all() def preexec_fn(): if orig_preexec_fn: orig_preexec_fn() signal_mask.reset_all() signal_mask.unmask_all(oldmask) kwargs['preexec_fn'] = preexec_fn try: return orig_Popen(args, **kwargs) finally: signal_mask.unmask_all(oldmask)
def preexec_fn(): if orig_preexec_fn: orig_preexec_fn() signal_mask.reset_all() signal_mask.unmask_all(oldmask)
def test_reentrant_masked(self): oldmask = signal_mask.mask_all() self.test_masked() signal_mask.unmask_all(oldmask) self.test_unmasked()