Re: order of GSignal callbacks



On Fri, 5 Oct 2001 vishnu pobox com wrote:

> Is there an easy way to write an assertion about the order of
> callbacks?  For example, i have:
> 
> g_signal_connect (instance, "set-span", G_CALLBACK (cb1), mydata);
> 
> // and somewhere else in my code
> g_signal_connect (instance, "set-span", G_CALLBACK (cb2), mydata);
> 
> i'm already using all of the signal execution stages (before, during,
> after) for ordering.  i'm asking about checking ordering within a stage.

could you say what/how exactly you're using the different stages for?
i'm not quite sure what you mean here, since we essentially have
5 stages:

1 - Invocation of the object method handler for G_SIGNAL_RUN_FIRST signals 

2 - Invocation of normal user-provided signal handlers (after flag FALSE) 

3 - Invocation of the object method handler for G_SIGNAL_RUN_LAST signals 

4 - Invocation of user provided signal handlers, connected with an after flag of TRUE 

5 - Invocation of the object method handler for G_SIGNAL_RUN_CLEANUP signals 

(return values are accumulated from stages 1-4 only).

> Something like:
> 
> g_assert (g_signal_handler_order_by_func
>                (instance, "set-span", 0 /*detail*/, cb1, cb2) < 0);

erm, what would g_signal_handler_order_by_func() do exactly, compare
the order of two callbacks given?
i don't see much point in supplying such a thing (or, what would be
required at the basic layer to get this going, a function that assigns
a numerical id to a closure that relates to its call-order).

the signal system however makes the guarantee, that, if you connect
two handlers like this:

signal_connect (foo);
signal_connect (bar);

bar will be executed after foo. i.e. within a stage, handlers are
called during an emission in the order they got connected.

> 
> Could i write such a function using the current API?
> 
> -- 
> Victory to the Divine Mother!!
>   http://sahajayoga.org
> 

---
ciaoTJ





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