maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Threading in Python (https://talk.maemo.org/showthread.php?t=77406)

blck 2011-09-21 00:06

Threading in Python
 
Hi,
I'm writing currently a app, which fetches different content from various sites. I am using Threads for preventing the interface from freezing. The Update-Process is splitt into currently 4 Sites, every site is a Thread. How do I get Python to start one Thread and after this one is finished, start another one?

The basic Idea is simple, by doing something like this:
Code:

update_ntv = updateNTVall("none","none")
update_ntv.begin()
fenster.connect(update_ntv, SIGNAL("finished()"), starteEngadget)

I get the app to first update NTV (German News Site) and then start the Engadget-Thread and afterwards a special routine out off my code.

Since I'm on my way to implement more and more Sites it kinda sucks to do this for every site. It would be nice to create a list of Threads eg: (NTV.begin,engadget.begin) and then triggger it Thread by Thread (everytime one Thread is finished - start another one). A while-loop let's the interface freeze again.

Any ideas?

Blck

konttori 2011-09-21 07:24

Re: Threading in Python
 
Why not use a single thread instead and put each of the sites to be scanned in that thread, one at a time?

blck 2011-09-22 01:29

Re: Threading in Python
 
Hi,
thanks for your answer konttori. Unfortunately this isn't possible, as this would be followed by redisgning the app. The Update-Thread for each site is different and a bit complex.
Thath's why executing a list (something like that) would acutally be great.

MfG Blck


All times are GMT. The time now is 03:32.

vBulletin® Version 3.8.8