On Monday, 13 February 2017 at 01:30:57 UTC, ag0aep6g wrote:
This doesn't make sense to me. b depends on a. If I run thread
1 alone, I can expect b to be 1, no? Thread 2 can then a) read
0, write 1; or b) read 1, write 2. How can b be 0 when the
writeln is executed?
An example like this make
On 02/13/2017 01:27 AM, Moritz Maxeiner wrote:
__gshared int a = 0;
// thread 1:
a = 1;
int b = a;
writeln(b);
// thread 2:
a += 1;
In the above, you may expect `b` to be either 1, or 2, depending on how
the cpu interleaves the memory access, but it can, in fact, also be 0,
since neither the c
On Monday, 13 February 2017 at 00:56:37 UTC, Nestor wrote:
On Sunday, 12 February 2017 at 05:54:34 UTC, Era Scarecrow
wrote:
Ran some more tests.
Wow!
Thanks for the interest and effort.
Certainly. But the bulk of the answer comes down that the 2
levels that I've already provided are the f
On Sunday, 12 February 2017 at 05:54:34 UTC, Era Scarecrow wrote:
On Saturday, 11 February 2017 at 21:56:54 UTC, Era Scarecrow
wrote:
Just ran the unittests under the dmd profiler, says the
algorithm is 11% faster now. So yeah slightly more optimized.
Ran some more tests.
Without optimizatio
On Sunday, 12 February 2017 at 20:08:05 UTC, bitwise wrote:
It seems like you're saying that 'shared' should mean both
'thread safe' and 'not thread safe' depending on context, which
doesn't make sense.
Makes sense to me: A `shared` variable is shared among threads.
Accesses are not thread-sa
On Sunday, 12 February 2017 at 20:08:05 UTC, bitwise wrote:
It seems that methods qualified with 'shared' may be what
you're suggesting matches up with the 'bridge' I'm trying to
describe, but again, using the word 'shared' to mean both
'thread safe' and 'not thread safe' doesn't make sense. [.
On Saturday, 11 February 2017 at 04:32:37 UTC, Michael Coulombe
wrote:
On Friday, 10 February 2017 at 23:57:18 UTC, bitwise wrote:
[...]
A shared method means that it can only be called on a shared
instance of the struct/class, which will have shared fields. A
shared method should be logical
On Sunday, 12 February 2017 at 03:34:19 UTC, Michael Coulombe
wrote:
Do you have a complete code example that gives your error? I
can't reproduce it (DMD v2.073.0):
int foo(T...)(T vars) {
int i = 0;
foreach(ref v ; vars) {
v = 5;
i += v;
}
return i;
}
void bar
On Saturday, 11 February 2017 at 03:21:29 UTC, mashomee wrote:
Hi, everyone.
I have a thread running in Dll. But it always halts because of
access violation exception when GC begins collecting.
[...]
It's great that you're found a workaround. If you weren't doing
something funky to trigger