2 ms·
I was of course discussing the semantics of a C-like language, especially in light of the C++11 memory model. Being memory safe at all cost, java (and any othe
by gpderetta 10y ago
I was of course discussing the semantics of a C-like language, especially in light of the C++11 memory model.
Being memory safe at all cost, java (and any other shared-memory memory safe language) must guarantee minimum of safety to concurrent reference updates. A JVM which uses reference counting instead of a proper GC would be interesting to implement...
You can't currently put a shared_ptr in an atomic<> variable as it does not meet the concept requirements (Trivially constructible and copyable), but, IIRC, you will in C++17 and, yes, even relaxed loads will be expensive (in practice implementations are expected to lock a spinlock around every operation)