It is best not to use multi-threading to achieve concurrency, but to useselect或gevent, refer to the Python documentation Socket Programming HOWTO and gevent tutorial.
Python multi-threading is a pitfall. Due to the existence of GIL, the efficiency of multi-threading is not necessarily better than single-threading. The same person upstairs suggested using some network libraries developed based on coroutines
It is best not to use multi-threading to achieve concurrency, but to use
select
或gevent
, refer to the Python documentation Socket Programming HOWTO and gevent tutorial.Python multi-threading is a pitfall. Due to the existence of GIL, the efficiency of multi-threading is not necessarily better than single-threading. The same person upstairs suggested using some network libraries developed based on coroutines