Use the masking function (``sigprocmask(2)`` or ``pthread_sigmask(3)``)
        to unblock signals.

        :raises ValueError:
            If the old mask is not obtained yet. This only happens in when
            ``setmask=True`` was passed to the initializer and ``unblock()`` is
            called before ``block()`` was called.

        This method uses either ``SIG_SETMASK`` or ``SIG_UNBLOCK``, depending
        on how the object was constructed. Actual behavior differs as explained
        below. In both cases the term *old mask* refers to the effective mask
        that was obtained at the time :meth:`block()` was called.

        - In the ``SIG_SETMASK`` mode the old mask is restored (overwrite)
        - In the ``SIG_UNBLOCK`` mode the old mask is ignored and the desired
          signals are unblocked (incremental change)

        .. note::
            This method is a no-op if signal blocking is currently inactive (as
            determined by :meth:`is_active` returning False).

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

        :raises ValueError:
            If the old mask is not obtained yet. This only happens in when
            ``setmask=True`` was passed to the initializer and ``unblock()`` is
            called before ``block()`` was called.

        This method uses either ``SIG_SETMASK`` or ``SIG_UNBLOCK``, depending
        on how the object was constructed. Actual behavior differs as explained
        below. In both cases the term *old mask* refers to the effective mask
        that was obtained at the time :meth:`block()` was called.

        - In the ``SIG_SETMASK`` mode the old mask is restored (overwrite)
        - In the ``SIG_UNBLOCK`` mode the old mask is ignored and the desired
          signals are unblocked (incremental change)

        .. note::
            This method is a no-op if signal blocking is currently inactive (as
            determined by :meth:`is_active` returning False).
        """
        if not self._is_active:
            return
        if self._setmask:
            if self._old_mask is None:
                raise ValueError("block() wasn't called yet!")
            self._do_mask(SIG_SETMASK, self._old_mask, None)
            self._old_mask = None
        else:
            self._do_mask(SIG_UNBLOCK, self._mask, None)
        self._is_active = False