Re: Re-setting the callback function from within ... the callback function?

On 17 Apr 2001, Havoc Pennington wrote:

> Chris Quinn <cq htec demon co uk> writes: 
> > Thanks for the suggestion. Unfortunately it isn't the signal just
> > emitted that needs blocking but the next, which doesn't exist until
> > a callback is attached by which time it is too late!
> > 
> > I note that my version is 1.2.5. But I guess your 'misfeature'
> > comment relates to the latest version. Do you know if it will it
> > remain a misfeature, especially if, as it appears to me, it hinders
> > implementation in the Continuation Passing Style, a style prevalent
> > in the functional programming community (I myself am using an ML
> > binding of the gtk calls)? If it is to remain, what are the chances
> > of success hacking a fix into the source myself?
> > 
> All versions that I know of contain this misfeature. It's possible
> that Tim who does the signal stuff doesn't agree it's a misfeature, I
> haven't asked him.

i think you're right, this is something i've been wondering about since
around the 1.0 release or so.
at this point, i don't really expect people to rely on the current
behaviour, in most cases where you actually encounter it, it's more a
problem to work around than a feature.

> You can try to hack on this code, but it's beastly complex in there.

the actuall change required is not so hard, i've basically added a check
to the emisson code to not call signal handlers with ids newer than
the ones given out at the start of the emission (that's just another
gulong comparision per handler invocation, so not as expensive as e.g.
"freezing" the list of handlers to call at emission start by doing a

> The main reason I'd consider it a misfeature is simply that people
> don't expect it to happen, it doesn't really make sense to be notified
> of an event that occurred before you connected the event listener. 
> Sort of a time warp effect.
> Suggest filing a report on with rationale.
> Havoc


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