[dmd-concurrency] draft 7
Michel Fortin
michel.fortin at michelf.com
Mon Feb 1 05:47:29 PST 2010
Quote from draft 7:
> Anyway, real is meant mostly for high-precision temporary results and not for data interchange, so it makes little sense to want to share it anyway.
Are you sure? Real is perfect for *inter-thread* data interchange. If you're splitting a long computation between different threads, why would you want to cut precision when communicating back the result?
> auto lock = Lock(_guard);
Shouldn't you mention it's a C++ idiom?
> The program would compile successfully with the following changes to nyukNyuk and sneaky:
>
> shared(double)* nyukNyuk; // or: shared(double*) nyukNyuk;
> void sneaky(ref shared(double) r) { nyukNyuk = &r; }
How can that be safe? Leaking the reference, even as 'shared', doesn't prevent someone from accessing the variable without acquiring the lock. Are you suggesting that mixing atomic operations and mutex synchronization for the same variable is okay? Because it's not.
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the dmd-concurrency
mailing list