Re: multi-threaded apps.




On Fri, 18 Aug 2000, James Henstridge wrote:

> On Thu, 17 Aug 2000, Ian Campbell wrote:
> 
> > 
> > 
> > I am busy checking that Balsa correctly grabs the GDK lock when running with
> > threads enabled.
> > 
> > The FAQ says that Glib callbacks (I/O, idle and timeouts) are called without
> > the lock, but that GTK+ callbacks will be called with the lock held.
> 
> the gtk lock is not acquired before calling idle, timeout or IO functions
> (no matter if you use the gtk or glib APIs).
> 

That's what I was expecting, I probably should have been clearer.

> > 
> > I cannot find the point where the lock is grabbed when emitting the GTK+
> > signal.
> > 
> > So my question is: If I emit a signal in a thread, do I need to grab the lock
> > before emmiting the signal?
> 
> Well, the gtk_signal_emit function is a gtk function, so you should grab
> the lock before calling it.  So if you want to emit a signal from an idle
> or timeout function, you will need to do GDK_THREADS_ENTER() and
> GDK_THREADS_LEAVE() around the gtk calls.
> 

Thats exactly what I wanted to know... Thank you... For some reason I
wasn't considering gtk_signa_emit to be a  a gtk function. Duh!

I expect I should use the lowercase variants though ?


> > 
> > Cheers,
> > Ian.
> > 
> 
> James.
> 
> -- 
> Email: james@daa.com.au
> WWW:   http://www.daa.com.au/~james/
> 
> 
> 






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