Author Tom Cook
Recipients Tom Cook
Date 2017-12-07.15:09:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
If nothing connects to it, `multiprocessing.connection.Listener.accept()` will block forever with no good way to interrupt it.

Supposing that a thread implements a loop like this:

    def run(self):
        l = Listener(socket_path, 'AF_UNIX')
        while self.running:
            c = l.accept()
            while self.running:
                data = c.recv()

There is no obvious way to implement a `stop` method on this thread.  Setting `self.running = False` may never result in the thread terminating, as it may be that no client connects to it.  The following is a possible way of implementing it:

    def stop(self):
        self.running = False
            c = Client(socket_path, 'AF_UNIX')

however it seems fraught with race conditions.  Letting `accept()` accept a timeout would be a much cleaner solution to this and many similar problems.
Date User Action Args
2017-12-07 15:09:59Tom Cooksetrecipients: + Tom Cook
2017-12-07 15:09:59Tom Cooksetmessageid: <>
2017-12-07 15:09:59Tom Cooklinkissue32244 messages
2017-12-07 15:09:59Tom Cookcreate