Re: Does gtk_signal_emit operate synchronously



On 06 Apr 2001 12:32:30 -0500, Kent Schumacher wrote:
I'm wondering if gtk_signal_emit does all of it's signal emitting before it
returns to the caller (as opposed to queuing up activities for later).

For example, say I want to pass a pointer around: can I do this safely?
(Assume I have the marshaller and signal signature set up correctly).

gpointer bob = g_malloc(1000);

gtk_signal_emit(GTK_OBJECT(obj),object_signals[RESYNC_SIGNAL],bob);

g_free(bob);

Thanks
Kent

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

yeah, you can do that. The GtkObject stores a list of listeners for each
signal (listeners listening by gtk_signal_connect...). When calling
gtk_signal_emit, all these functions are called (using the marshallers)
one after an other, before returning and continuing with the rest of the
caller-function. That's why signal are relatively slow, compared to
direct function calls. A lot of code has to be processed, allocation and
deallocation is done, so watch out for time-critical functions.

-- 
Jeroen Benckhuijsen

Software Engineer
Phoenix Software




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