[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-list
Subject:    Re: How to shut down a TCPServer serve_forever() loop?
From:       Ian Kelly <ian.g.kelly () gmail ! com>
Date:       2017-11-28 19:04:10
Message-ID: CALwzidnhK5QLTn1S9zL5VBNe8mjonK8wVj3PZRFhaJcVPF6mSA () mail ! gmail ! com
[Download RAW message or body]

On Tue, Nov 28, 2017 at 11:54 AM, Marko Rauhamaa <marko@pacujo.net> wrote:
> Chris Angelico <rosuav@gmail.com>:
>> Would the OP have been trivially able to send a signal to the
>> process? Yes.
>
>    Python signal handlers are always executed in the main Python thread,
>    even if the signal was received in another thread. This means that
>    signals can't be used as a means of inter-thread communication.
>
>    <URL: https://docs.python.org/3/library/signal.html#signals-and-threads>

Being received in the other thread, it would still interrupt the
system call however, wouldn't it? Quoting from the doc:

"However, if the target thread is executing the Python interpreter,
the Python signal handlers will be executed by the main thread.
Therefore, the only point of sending a signal to a particular Python
thread would be to force a running system call to fail with
InterruptedError."
-- 
https://mail.python.org/mailman/listinfo/python-list

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic