# Path: coolamqp/utils.py
# IMPORT_ERRORS = (ModuleNotFoundError, ImportError)
# IMPORT_ERRORS = (ImportError, )
# def prctl_set_name(name):


from abc import ABCMeta, abstractmethod
from coolamqp.utils import monotonic
import heapq
import typing as tp
import six
        """

    def close_socket(self, sock):   # type: (BaseSocket) -> None
        del self.fd_to_sock[sock.fileno()]
        sock.on_fail()
        self.noshot(sock)
        sock.close()

    def shutdown(self):
        """
        Forcibly close all sockets that this manages (calling their on_fail's),
        and close the object.

        This object is unusable after this call.
        """
        self.time_events = []
        for sock in list(six.itervalues(self.fd_to_sock)):
            sock.on_fail()
            sock.close()

        self.fd_to_sock = {}

    def oneshot(self, sock, delta, callback):
        """
        A socket registers a time callback
        :param sock: BaseSocket instance
        :param delta: "this seconds after now"
        :param callback: callable/0
        """
        if sock.fileno() in self.fd_to_sock:

# Path: coolamqp/utils.py
# IMPORT_ERRORS = (ModuleNotFoundError, ImportError)
# IMPORT_ERRORS = (ImportError, )
# def prctl_set_name(name):


# Path: coolamqp/uplink/listener/base_listener.py
from abc import ABCMeta, abstractmethod
from coolamqp.utils import monotonic
import heapq
import typing as tp
import six

        """

    def close_socket(self, sock):   # type: (BaseSocket) -> None
        del self.fd_to_sock[sock.fileno()]
        sock.on_fail()
        self.noshot(sock)
        sock.close()

    def shutdown(self):
        """
        Forcibly close all sockets that this manages (calling their on_fail's),
        and close the object.

        This object is unusable after this call.
        """
        self.time_events = []
        for sock in list(six.itervalues(self.fd_to_sock)):
            sock.on_fail()
            sock.close()

        self.fd_to_sock = {}

    def oneshot(self, sock, delta, callback):
        """
        A socket registers a time callback
        :param sock: BaseSocket instance
        :param delta: "this seconds after now"
        :param callback: callable/0
        """
        if sock.fileno() in self.fd_to_sock:

            heapq.heappush(self.time_events, (monotonic() + delta,