On Thursday, 18 October 2018 at 16:31:02 UTC, Stanislav Blinov wrote:
So again,

void atomicInc(shared int*); // is "not safe", but
void struct_Atomic_int_opUnary_plus_plus(ref shared Atomic); // is "safe"

just because latter is a "method". And that, by you, is hunky-dory? Whether it's a method or a free function, it's written to work on *shared* data. Of course it wouldn't be safe if you allow any non-shared data to become shared without the programmer having a say in this.

Out of curiosity, when it comes to primitives, what could you do under MP in void "atomicInc(shared int*)" that would be problematic?

void atomicInc(shared int*) {
  // i.e. what goes here?
}


Reply via email to