[Boost.Signals] One-shot slot?
22 Sep
2005
22 Sep
'05
3:32 a.m.
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!
6989
Age (days ago)
6989
Last active (days ago)
0 comments
1 participants
participants (1)
-
Simon Buchan