Hello, if I create a signal sig with n slots (slots are ordered by group). What happens if : - I call sig(); and the first called slot removes the slot which is its successor - I call sig(); and the first slot connects a new slot to signal which has a higher priority (group -> higher values are executed at first) with best regards, Oliver -- "Der Spezialist ist ein Barbar, dessen Unwissenheit nicht allumfassend ist." Master's Voice, S.LEM
On Aug 1, 2004, at 12:38 PM, Oliver Kowalke wrote:
if I create a signal sig with n slots (slots are ordered by group). What happens if :
- I call sig(); and the first called slot removes the slot which is its successor
Then the successor doesn't get called (since it has been disconnected).
- I call sig(); and the first slot connects a new slot to signal which has a higher priority (group -> higher values are executed at first)
According to the docs, it's unspecified whether or not this slot will be called. FYI, no need to CC me privately. Better to write to the list, only. Doug
Am Montag, 2. August 2004 01:25 schrieb Doug Gregor:
- I call sig(); and the first slot connects a new slot to signal which has a higher priority (group -> higher values are executed at first)
According to the docs,
docs : http://www.boost.org/doc/html/signals.html ?
it's unspecified whether or not this slot will be called.
Because I need only the topmost slot called, I could add a combiner which dereferences only one time and loop over signal - could result in side effects?! struct call_topmost { typedef void result_type; template<typename InputIterator> result_type operator()(InputIterator first, InputIterator last) const { if ( first != last) * first; } }; ... boost::signal< void(), call top_most > sig; .... while ( ! sig.empty() ) sig(); // each called slot will be disconnected ... with best regards, Oliver -- "Der Spezialist ist ein Barbar, dessen Unwissenheit nicht allumfassend ist." Master's Voice, S.LEM
On Aug 2, 2004, at 12:48 AM, Oliver Kowalke wrote:
Am Montag, 2. August 2004 01:25 schrieb Doug Gregor:
- I call sig(); and the first slot connects a new slot to signal which has a higher priority (group -> higher values are executed at first)
According to the docs,
Yes.
it's unspecified whether or not this slot will be called.
Because I need only the topmost slot called, I could add a combiner which dereferences only one time and loop over signal - could result in side effects?!
struct call_topmost { typedef void result_type;
template<typename InputIterator> result_type operator()(InputIterator first, InputIterator last) const { if ( first != last) * first; } };
Yes, this will invoke only the first slot, which is of course free to remove itself or connect other slots. Doug
participants (2)
-
Doug Gregor
-
oliver.kowalke@t-online.de