Clears either all the callbacks or the callbacks for a particular
        signal.
        
        :param      signal | <variant> || None
429637
def clear(self, signal=None):
        
        if signal is not None:
            self._callbacks.pop(signal, None)
        else:
            self._callbacks.clear()
171744
def signal_handler(self, *args):
        
        self.user_callback(self.signal, self.user_arg, *args)
792673
def release(self, signal=True):
        
        if not self.needs_lock:
            return
        with self.synclock:
            self.lock.release()
            if signal:
                self.released_event(self)
            self.synclock.notify_all()
649774
def _signal_handler(self, *_) -> None:
        
        if self._num_signals == 0:
            logging.warning('Interrupt signal caught - training will be terminated')
            logging.warning('Another interrupt signal will terminate the program immediately')
            self._num_signals += 1
        else:
            logging.error('Another interrupt signal caught - terminating program immediately')
            sys.exit(2)
449653
def kill(self, signal=None):
        

        return self.client.api.kill(self.id, signal=signal)
690850
private function clearSigHandlers() {
        pcntl_signal(SIGTERM, SIG_DFL);
        pcntl_signal(SIGINT,  SIG_DFL);
        pcntl_signal(SIGQUIT, SIG_DFL);
        pcntl_signal(SIGUSR1, SIG_DFL);
        pcntl_signal(SIGUSR2, SIG_DFL);
        pcntl_signal(SIGCONT, SIG_DFL);
    }
849176
def clear_signal_handlers(self):
        '''

        '''
        signal.signal(signal.SIGABRT, self.old_sigabrt)
        signal.signal(signal.SIGINT, self.old_sigint)
        signal.signal(signal.SIGPIPE, self.old_sigpipe)
        signal.signal(signal.SIGTERM, self.old_sigterm)
224477
def _disconnect_signals(self, model):
        
        for signal, receiver in self._signals.items():
            signal.disconnect(sender=model, dispatch_uid=self._dispatch_uid(signal, model))
815191
public static function Unlisten($signal_type, $callback)
    {
        if(!isset(self::$listeners[$signal_type]))
            return;

        if(is_array(self::$listeners[$signal_type]))
        {
            foreach(self::$listeners[$signal_type] as $position => $callback_data)
            {
                $stored_callback = $callback_data['callback'];

                if($callback == $stored_callback)
                {
                    unset(self::$listeners[$signal_type][$position]);
                    break;
                }
            }
        }

        if(count(self::$listeners[$signal_type]) <= 0)
            unset(self::$listeners[$signal_type]);
    }
494163
function clearEvent(emitter, evt) {
  if (--emitter._eventsCount === 0) emitter._events = new Events();
  else delete emitter._events[evt];
}
390502
def close(self):
        
        with self._close_lock:
            sfd = self._sfd
            if sfd >= 0:
                self._sfd = -1
                self._signals = frozenset()
                close(sfd)
238007
public function removeSignal($signal)
    {
        if (isset($this->_signalEvents[$signal])) {
            $event = $this->_signalEvents[$signal];
            event_del($event);
            unset($this->_signalEvents[$signal]);
        }
    }
1032048
def disconnect_signals(self):
        """"""
        # Disconnect the signals inside each Work.
        for work in self:
            work.disconnect_signals()

        # Disable callbacks.
        for cbk in self._callbacks:
            cbk.disable()
135644
def cancel():
    
    cancel = threading.Event()

    def cancel_execution(signum, frame):
        signame = SIGNAL_NAMES.get(signum, signum)
        logger.info("Signal %s received, quitting "
                    "(this can take some time)...", signame)
        cancel.set()

    signal.signal(signal.SIGINT, cancel_execution)
    signal.signal(signal.SIGTERM, cancel_execution)
    return cancel
345267
def kill_all(signal)
      idle, running = partition_workers
      log "kill -#{signal} #{running.map { |r| r.pid }.inspect}"
      running.each { |worker| worker.kill(signal) }
    end
862170
def remove_cruft(signal)
      parts = signal.split(".")
      [
        parts[0..-3].join('.'),
        parts.pop
      ].join('.')
    end
1281341
def filter_properties_signals(f, signal_iface_name):
    
    @wraps(f)
    def wrapper(iface, changed_props, invalidated_props, *args, **kwargs):
        if iface == signal_iface_name:
            f(changed_props, invalidated_props)

    return wrapper