requests.{get,post} timeout

Marko Rauhamaa marko at pacujo.net
Wed Aug 23 10:07:24 EDT 2017


Jon Ribbens <jon+usenet at unequivocal.eu>:

> Yes, what I was interested to learn was how the monitoring thread can
> "cut off" the requesting thread.

In general, that cannot be done. Often, you resort to a dirty trick
whereby the monitoring thread closes the I/O object requesting thread is
waiting on, triggering an immediate I/O exception in the requesting
thread.

The fact that threads cannot be terminated at will is one of the big
drawbacks of the multithreaded programming model. Note that coroutines
can always be interrupted at await.


Marko



More information about the Python-list mailing list