Re: [gtkmm] drawing from a non-gui thread.



Why is it bad design? Even if I use locks and mutexes?


On Fri, 13 Jun 2003, Daniel Sundberg wrote:

> On Fri, 13 Jun 2003 12:10:48 -0400 (EDT)
> Silviu D Minut <minutsil cse msu edu> wrote:
>
> > I'm writing an application, which has a GUI thread and a work thread. The
> > work thread runs in a loop and must draw something on the gui every 10000
> > iterations, say (as opposed to using a timer, as in the radar.cc example).
> > Please see the attached file.
> >
> > Since I haven't seen any example doing precisely that (drawing from a
> > non-gui thread), I'm thinking to contribute this to the examples, but I'd
> > like to check its correctness with the list. Does anybody see any
> > obvious flaws?
> >
>
> The reason why there are no such examples is that it is considered to be bad code design. All GUI code should be in one thread and working threads should send messages or something like that to the GUI thread.
>
> However, it is possible to draw the GUI from another thread but you should consider using some kind of messaging system instead.
>
> ---
> Daniel Sundberg
> http://sumpan.com
>
> > Thanks!
> >
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]