def block(self):
        """
        Use the masking function (``sigprocmask(2)`` or ``pthread_sigmask(3)``)
        to block signals.

        This method uses either ``SIG_SETMASK`` or ``SIG_BLOCK``, depending on
        how the object was constructed. After this method is called, the
        subsequent call to :meth:`unblock()` will undo its effects.

        .. note::
            This method is a no-op if signal blocking is currently active (as
            determined by :meth:`is_active` returning True).
        """
        if self._is_active:
            return
        if self._setmask:
            self._old_mask = sigset_t()
            sigemptyset(self._old_mask)
            self._do_mask(SIG_SETMASK, self._mask, self._old_mask)
        else:
            self._do_mask(SIG_BLOCK, self._mask, None)
        self._is_active = True