How to use two threads (GUI and backend)

Chris Angelico rosuav at gmail.com
Wed Oct 26 09:18:50 EDT 2016


On Thu, Oct 27, 2016 at 12:02 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
> pozz <pozzugno at gmail.com>:
>
>> The real problem is that retrieving status from remote device is a
>> slow operation. If the GUI thread blocks waiting for the answer, the
>> GUI blocks and the user complains.
>
> Correct. Obnoxious, blocking APIs abound.
>
> However, I have usually used processes (instead of threads) to
> encapsulate blocking APIs. Processes have neater resource isolation and
> a better-behaving life cycle. For example, you can actually kill a
> process while you can't kill a thread.

Why is there so much FUD against threads? Processes involve a lot more
overhead, and are completely unnecessary for this task. Threads will
work just fine.

ChrisA



More information about the Python-list mailing list