Re: signals (and disconnecting them)



> Let's say we have the following code:
>
> some_func();
> g_signal_handlers_disconnect_by_func(obj, func, param);
>
>
> If some_func() causes a signal to be emitted on "obj" and then almost
> immediately I disconnect the handler, will my handler receive the
> event before being disconnected or is there a chance it might not.
> (for example if the event is queued).

I'm not an expert but:

Events that are queue'd are not scheduled until glib iterates again, so
they will be "lost" yes. Even signals you emit by hand will be "lost"
after the handler is unhooked. Atleast logic should be like that.

I can also mention that glib is to be access by only one thread at any
given time aswell, so other threads should be sleeping too while a thread
is activly talking to glib, and events are to be enqueued.



Stian



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