ldionne added inline comments.
================
Comment at: libcxx/include/future:556
bool __has_value() const
{return (__state_ & __constructed) || (__exception_ != nullptr);}
----------------
jfb wrote:
> I'm not auditing everything, but it seems like code above can still access
> __state_ without holding __mut_? Like in the dtor.
>
> Generally this patch lgtm because it's a step forward, but maybe we should
> separately refactor the code to make it so that accesses to __state_ require
> passing in a reference to lock_guard to show we actually hold __mut_. It
> would ignore that reference, but that's a way to enforce, in the type system,
> that __state_ is only touched when the lock is held.
>
> WDYT?
I think you're right, and I filed this bug to keep track of the issue:
https://bugs.llvm.org/show_bug.cgi?id=38688
Not all of them need a lock (some are in the constructor where only one thread
has a reference to the data, for example), but most of them probably do.
Repository:
rCXX libc++
https://reviews.llvm.org/D51170
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits