|
Boost : |
Subject: [boost] [future N2561] Implementation comments
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2008-12-03 04:33:17
Hi,
on the current Future (N2561) library proposal the promise protect the value setting/getting from multiple threads using a lock, but the lock do not protect the future initialization (lazy_init()).
void set_value(typename detail::future_traits<R>::source_reference_type r)
{
lazy_init();
boost::lock_guard<boost::mutex> lock(future->mutex);
if(future->done)
{
throw promise_already_satisfied();
}
future->mark_finished_with_result_internal(r);
}
I'm wondering if we don't need to extend the protection or avoid the lazy initialization? I'm missing something?
BTW, Is it safe to take the address of a promise? If not, why not delete the operator&()?
Best,
Vicente
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk