Re: multi-threaded apps.



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).

> 
> 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.

> 
> 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]