Asynchronous - Are some of Python's built-in functions blocking or non-blocking?
黄舟
黄舟 2017-07-05 10:34:24
0
1
876

I have always had some questions. Are some functions and common libraries of python blocking? For example, print, socket connection, etc. Are there any simple solutions for blocking, non-blocking, asynchronous, etc.?
Is there any clear language support for asynchronous parallelism? I have used nodejs callbacks and can't stand it. The latest ES seems to have improved.

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(1)
滿天的星座

Use gevent, the coroutine solution,
pass the statement from gevent import monkey; monkey.patch_socket() patch the IO function, and you can set it to blocking

If you are using python3, you can also use asyncio, a coroutine solution that has been added to the standard library

Coroutines are syntactic sugar for asynchronous callbacks. Use synchronous writing to achieve asynchronous effects. You deserve it

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!