Re: [sigc] Handling signal loops
- From: "Timothy M. Shead" <tshead k-3d com>
- To: "Andrew E. Makeev" <andrew solvo ru>
- Cc: "libsigc-list gnome org" <libsigc-list gnome org>
- Subject: Re: [sigc] Handling signal loops
- Date: Mon, 26 Sep 2005 22:48:57 -0600
On Mon, 2005-09-26 at 10:25 +0400, Andrew E. Makeev wrote:
> Timothy M. Shead wrote:
>
> >I'm wondering if anyone has come across a way to handle signal "loops" -
> >that is to say, if signal A is connected to signal B, and B to A, is
> >there any way to prevent emission of either from entering an infinite
> >loop? I tried creating a custom accumulator, but discovered that a new
> >instance of the accumulator is created every time emit() is called. I
> >know it sounds crazy, but I'd like to find a way to see that every
> >signal in a given loop gets called, then the loop is broken.
> >
> >
> >
> >
> Try static member for accumulator class, and increase it in each signal
> callback, so, when you hit "odd" number, for example, stop the signal
> emission with accumulator return state.
> Guess, that's clear.
Seems like I could use this to impose an arbitrary limit on the number
of emissions that take place, and thus prevent infinite loops, but I
would have know way of knowing whether I'd hit every signal
once-and-only-once, or whether I terminated too soon ... unless I'm
missing something?
Many thanks,
Tim
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]