Le Wednesday 26 March 2008 02:39:39 Peter Brooks, vous avez écrit :
> Ie we want to know the latest metadata & the status of the cue button
> regally, the current design on the svn creates a new thread for each
> watcher. This obviously being quite wasteful on system resources if we
> have 20 things watching and 20 threads.
> Also the current system doesn't check if it has anything new to emit,
> it just emits data no matter what. Ie If there's no changes in the
> queue it still emits a signal and  bothers the liststore checkers.

For such a need, we recently implemented a similar thing using the "select" 
call. I think it's available in python:
  http://docs.python.org/lib/module-select.html
But it may not be under windows..

The basic for such thing is a main thread, which waits on the interesting 
sockets, and perform actions when needed. And for timed events, you also have 
a timeout parameter.

That way you can map several watch processes inside a single "collaborative" 
thread. 


Romain
-- 
How can a man
Discover a land
That already populated with Indians?

Répondre à