Python: Socket and threads?

前端 未结 4 800
情书的邮戳
情书的邮戳 2020-12-10 04:43

I have a design problem:

I have two threads, a heartbeat/control thread and a messagehandler thread.

Both are sharing the same socket, however the messageHan

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-10 04:46

    I don't know of a way to prioritize at the Python level.

    So I'd suggest using 2 processes, not threads, and prioritize at the OS level. On Unix you can use os.nice() to do that.

    You'd need to use 2 sockets then, and your sharing problem would be solved at the same time.

提交回复
热议问题