Design Question: GUI+Threads.
Frithiof Andreas Jensen
frithiof.jensen at removethis.ted.ericsson.dk
Fri Oct 24 07:52:35 EDT 2003
More information about the Python-list mailing list
Fri Oct 24 07:52:35 EDT 2003
- Previous message (by thread): ANN: Rekall V2.1.0 stable is released
- Next message (by thread): Design Question: GUI+Threads.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Thaks for the reply, "Brian Kelley" <bkelley at wi.mit.edu> wrote in message news:3f97ee4a$0$573$b45e6eb0 at senator-bedfellow.mit.edu... > Syver Enstad wrote: > > You might make your life easier by having the controller and the view be > on the main thread and dispatch a new model to the work thread. Hmm. I think that makes sense, since it is the GUI that "demands" attention - I was doing sort-of the other way round by having a thread dispatching messages to models AND the GUI thread.... > Usually you can wrap model events into gui events and let the gui's > mainloop sort them out and dispatch them to the controllers callbacks. So, To make sure that I understand correctly: I will have one Controller per Worker; the Controller interacts with the GUI and it is the Controller that "understands" that the Worker is running in a separate thread and maps GUI/Worker events across the thread boundary by some means - I was planning to use of a Dispatcher/Mailbox System: The worker thread(S) blocks on an input queue until a message is in that queue - then the worker thread process the message and places a result in an output queue. The results in the output queue(s) of each worker are read by the main thread and placed in the input queues of other workers or in the GUI.....most of the time a worker will sleep, waiting for work. The input and output queues would be owned by the workers, the "distribution lists" i.e. which event goes where would be owned by a "Dispatcher" running in the main thread . While this is fine for Data, setting parameters etc. is clumsy: One needs to setup a filter to sort parameter messages from the data and do special processing - i would rather keep only data in the message loop. > In python it is thread safe to set variables across the thread boundary, > the model will have to check for these variables changing though. ...I will need locking in the models setXyz() methods so that I do not stomp on some data that the worker thread is using? > What gui framework are you using? wxPython - in the hope that SciPy eventually will do a Python 2.2.3 release, so that by the time I need it, I can get my hands on all those neat Plotting, Numeric and Stats tools waiting to be liberated ;-)
- Previous message (by thread): ANN: Rekall V2.1.0 stable is released
- Next message (by thread): Design Question: GUI+Threads.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list