|
Boost : |
Subject: [boost] signal is thread-safe?
From: jon_zhou_at_[hidden]
Date: 2009-09-26 04:14:47
I wonder if the 'signal' lib is thread-safe?
i.e. a publisher is doing something, at the same time a subscriber is trying to 'disconnect' from the slot, will it get problem?
Found that it only set a flag to indicate the slot in disconnection, but never remove the slot?
So that the lib is thread-safe?
**********************
It won't remove anything from the 'slots' container:
template<typename Function>
void do_disconnect(const Function& f, mpl::bool_<false>)
{
// Notify the slot handling code that we are iterating through the slots
BOOST_SIGNALS_NAMESPACE::detail::call_notification notification(this->impl);
for (iterator i = impl->slots_.begin(); i != impl->slots_.end(); ++i) {
slot_function_type& s = *unsafe_any_cast<slot_function_type>(&i->second);
if (s == f) i->first.disconnect();
}
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk