Re: gtk & threads



* Martin Soto (masoto@uniandes.edu.co) wrote:
> Tom Gilbert <gilbertt@tomgilbert.freeserve.co.uk> writes:
> > > I see. Question. How difficult would it be to modify all the gtk/gdk
> > > functions to do it themselves, and have the callbacks spawn off the
> > > function they call in a new thread? If it is not too dificult, just time
> > > consuming, I would be willing to give it a stab.
> > 
> > Ouch. This would be a big job. I also think you will meet much
> > resistance from people who don't use threads, who would then inherit
> > their overhead (however large or small) from the gtk functions.
> 
> Just a question.  Is it necessary to directly modify gtk/gdk/glib to
> add threading support to them?  I have no experience with using
> threads, so I don't know for sure, but can't this be done with macros
> or small functions that wrap around the functions in the libraries?
> The wrappers would handle thread locking and call the library function
> to do the actual work.
> 
> Regards,
> 
> M. S.
> ------------
> Martin A. Soto J.                           Profesor
> Departamento de Ingenieria de Sistemas y Computacion
> Universidad de los Andes      masoto@uniandes.edu.co

Probably doable, I'd say, but its still not a really clean way of
handling it IMO. I don't know enough to suggest an ideal solution, but
for now, I reckon I'd use the existing functions, and to define a couple
of macros:

START_THREAD_STUFF
call some gtk/gtk funtions
call some more
call some more
END_THREAD_STUFF

so that those two macros would just gtk_threads_enter and _thread_leave,
and do whatever locking you need is probably fine short-term, so long as 
you don't want to go too far with it.

The gtk list will be much more knowledgable about this stuff than I.
Guarenteed!

Tom.
-- 
            .-------------------------------------------------------.
    .^.     | Tom Gilbert, England | tom@tomgilbert.freeserve.co.uk |
    /V\     |----------------------| www.tomgilbert.freeserve.co.uk |
   // \\    | Sites I recommend:   `--------------------------------|
  /(   )\   | www.freshmeat.net www.enlightenment.org www.gnome.org |
   ^^-^^    `-------------------------------------------------------'



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