Re: Avoid nested SIGINT handling

2021-11-13 Thread Eryk Sun
On 11/12/21, Mladen Gogala via Python-list wrote: > On Thu, 11 Nov 2021 17:22:15 +1100, Chris Angelico wrote: > >> Threads aren't the point here - signals happen immediately. > > [snip: description of POSIX signals] > > BTW, that's the case on both Unix/Linux systems and Windows systems. Windows

Re: Avoid nested SIGINT handling

2021-11-13 Thread Chris Angelico
On Sun, Nov 14, 2021 at 4:42 AM Mladen Gogala via Python-list wrote: > > On Thu, 11 Nov 2021 17:22:15 +1100, Chris Angelico wrote: > > > Threads aren't the point here - signals happen immediately. > > Actually, signals are not delivered immediately. Signals are delivered > the next time the proces

Re: Avoid nested SIGINT handling

2021-11-13 Thread Mladen Gogala via Python-list
On Thu, 11 Nov 2021 17:22:15 +1100, Chris Angelico wrote: > Threads aren't the point here - signals happen immediately. Actually, signals are not delivered immediately. Signals are delivered the next time the process gets its turn on CPU. The process scheduler will make process runnable and the

Re: Avoid nested SIGINT handling

2021-11-11 Thread Paulo da Silva
Às 06:22 de 11/11/21, Chris Angelico escreveu: > On Thu, Nov 11, 2021 at 5:01 PM Jon Ribbens via Python-list > wrote: >> >> On 2021-11-10, Paulo da Silva wrote: >>> Hi! >>> >>> How do I handle a SIGINT (or any other signal) avoid nesting? >> >> I don't think you need to. Python will only call sig

Re: Avoid nested SIGINT handling

2021-11-10 Thread Chris Angelico
On Thu, Nov 11, 2021 at 5:01 PM Jon Ribbens via Python-list wrote: > > On 2021-11-10, Paulo da Silva wrote: > > Hi! > > > > How do I handle a SIGINT (or any other signal) avoid nesting? > > I don't think you need to. Python will only call signal handlers in > the main thread, so a handler can't b

Re: Avoid nested SIGINT handling

2021-11-10 Thread Paulo da Silva
Às 21:55 de 10/11/21, Jon Ribbens escreveu: > On 2021-11-10, Paulo da Silva wrote: >> Hi! >> >> How do I handle a SIGINT (or any other signal) avoid nesting? > > I don't think you need to. Python will only call signal handlers in > the main thread, so a handler can't be executed while another han

Avoid nested SIGINT handling

2021-11-10 Thread Paulo da Silva
Hi! How do I handle a SIGINT (or any other signal) avoid nesting? Does this work? class STATUS: InInt=False def SIGINT_handler(sn,f): if STATUS.InInt: return STATUS.InInt=True process_int() STATUS.InInt=False Thanks for any suggestions. Paulo -- https:/

Re: Avoid nested SIGINT handling

2021-11-10 Thread Jon Ribbens via Python-list
On 2021-11-10, Paulo da Silva wrote: > Hi! > > How do I handle a SIGINT (or any other signal) avoid nesting? I don't think you need to. Python will only call signal handlers in the main thread, so a handler can't be executed while another handler is running anyway. -- https://mail.python.org/mai