Persistent Threads & Synchronisation
Matthew Tylee Atkinson
matthew at agrip.org.uk
Sun Nov 26 19:26:05 CET 2006
On Sun, 26 Nov 2006 13:24:21 +0100, Marc 'BlackJack' Rintsch wrote:
> There seems to be a misunderstanding of threads. You don't call functions
> in a thread from the main program. If you call a function from the main
> thread then the function is executed in the main thread. That's true for
> any call on `Thread` objects except for `start()` which really starts
> executing the `run()` method in a separate thread.
Aha, thanks very much for this!
> The easiest way for safe communication with threads is a `Queue` like
> the one in the `Queue` module. If you want a download thread that
> is running alongside the main program all the time then write a while loop
> that gets "commands" via a queue. Something like:
Brilliant! I will try it out soon.
Thanks very much for your help; it has really explained a lot!
Matthew Tylee Atkinson <matthew at agrip.org.uk>
More information about the Python-list