It seems different. It looks like Tornado uses an alarm and SIGALRM, whereas asyncio only checks elapsed time and so is unable to interrupt a blocked function.
Victor Le 7 oct. 2016 20:33, "Yury Selivanov" <[email protected]> a écrit : > > > On 2016-10-07 1:31 PM, Giampaolo Rodola' wrote: > >> On Fri, Oct 7, 2016 at 6:52 PM, Yury Selivanov <[email protected]> >> wrote: >> >> On 2016-10-07 11:16 AM, Guido van Rossum wrote: >>> >>> Maybe a simpler approach would be to write a linter that checks for a >>> >>>> known list of common blocking functions, and anything that calls those >>>> automatically gets the same property? >>>> >>>> What if somebody uses logging module and logs to a file? I think this >>> is >>> something that linters can't infer (how logging is configured). >>> >>> One way to solve this would be to monkeypatch the io and os modules >>> (gevent does that, so it's possible) to issue a warning when it's used in >>> an asyncio context. This can be done as a module on PyPI. >>> >>> Another way would be to add some kind of IO tracing hooks to CPython. >>> >> >> How about something like this? >> http://www.tornadoweb.org/en/stable/ioloop.html#tornado.iolo >> op.IOLoop.set_blocking_signal_threshold >> >> > Yes, we already have a similar mechanism in asyncio -- > loop.slow_callback_duration property that is used in debug mode. The thing > it isn't really precise, as you can have a lot of relatively fast blocking > calls that harm performance, but complete faster than > slow_callback_duration. > > Yury > _______________________________________________ > Python-ideas mailing list > [email protected] > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
