How to use two threads (GUI and backend)

jmp jeanmichel at sequans.com
Wed Oct 26 10:18:18 EDT 2016


On 10/26/2016 02:45 PM, pozz wrote:
> Il 26/10/2016 13:16, jmp ha scritto:
>> [...]
>> I suggest you write a GUI that make synchronous    calls to a remote
>> application, if possible. If the remote app is in python, you have
>> access to remote protocols already written for you, Pyro is one of them,
>> you can skip the low level communication part.
>
> I'm not sure Pyro (or similar alternatives) helps in my case.
>
> 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.
>
>  From Pyro documentation:
> ---
> Normal method calls always block until the response is returned. This
> can be any normal return value, None, or an error in the form of a
> raised exception. The client code execution is suspended until the
> method call has finished and produced its result.
> ---
>
> So, even with Pyro, I need to have another thread that manages Pyro
> communication (instead of serial communication)... additional problems.
>

Also from the Pyro doc:

You can execute a remote method call and tell Pyro: “hey, I don’t need 
the results right now. Go ahead and compute them, I’ll come back later 
once I need them”. The call will be processed in the background and you 
can collect the results at a later time.

[...]

It is possible to define one or more callables (the “call chain”) that 
should be invoked automatically by Pyro as soon as the result value 
becomes available.

jm




More information about the Python-list mailing list