$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Simon Buchan (simon_at_[hidden])
Date: 2005-09-21 22:32:48
What would be the simplest way to make a slot that,
once signaled, would disconnect itself? I thought
that boost::signals::trackable & 'delete this' would do
it, but it seems to be only for boost::bind functors...
I am trying:
my_slot* foo = new my_slot(...);
connection c = sig.connect(bind(foo));
foo->my_connection = c;
(vastly simplified, that probably wouldn't compile)
and have my_slot 'delete this' in it's op() and
'my_connection.disconnect()' in it's d'tor, but this
seems very inelegant, particlarly as this is in a
mutli-threaded environment (I know signal isn't thread-
safe, but some boost::mutex's normally do the trick)
Should I try using a Combiner to weed out slots marked
'once only' or something?
Many thanks in advance!