I'm trying to simulate a race condition in D with the following
code:
(https://run.dlang.io/is/RfOX0I)
```
import std.stdio;
import core.thread;
import std.concurrency;
shared struct IdGen(T)
{
T id;
this(T start)
{
id = start;
}
T next()
{
id = id.nex
On Wednesday, 29 November 2017 at 16:19:05 UTC, Michael wrote:
On Wednesday, 29 November 2017 at 16:13:13 UTC, Wanderer wrote:
[...]
I unfortunately cannot answer your question but I am noticing
that running the code with DMD gives you an unordered sequence
of IDs, but running with DMD-night
On Wednesday, 29 November 2017 at 16:33:50 UTC, Steven
Schveighoffer wrote:
On 11/29/17 11:13 AM, Wanderer wrote:
[...]
[snip]
[...]
Using the compiler switch -vcg-ast, I see no synchronization of
these methods.
[...]
That's what I assume, I was just lucky not to see a race.
Thanks fo
On Wednesday, 29 November 2017 at 17:03:42 UTC, Steven
Schveighoffer wrote:
On 11/29/17 11:13 AM, Wanderer wrote:
I'm trying to simulate a race condition in D with the
following code:
(https://run.dlang.io/is/RfOX0I)
One word of caution, I think the running of your code on
run.dlang.io is c
I wonder why `scope(exit)` code is not executed when the program
is terminated with Ctrl-C.
For example:
```
import std.stdio;
import core.thread;
void main()
{
scope (exit)
{
writeln("Cleanup");
}
writeln("Waiting...");
Thread.sleep(10.seconds);
writeln("Done w
On Saturday, 2 December 2017 at 01:26:14 UTC, Adam D. Ruppe wrote:
On Saturday, 2 December 2017 at 00:41:19 UTC, Wanderer wrote:
I wonder why `scope(exit)` code is not executed when the
program is terminated with Ctrl-C.
It depends on what your operating system is. On win32, I
believe it does
On Saturday, 2 December 2017 at 03:52:19 UTC, codephantom wrote:
On Saturday, 2 December 2017 at 00:41:19 UTC, Wanderer wrote:
Is there any method to cleanup on Ctrl-C?
// --
import std.stdio;
import core.thread;
extern(C) void signal(int sig, void function(int
On Wednesday, 28 May 2014 at 10:10:41 UTC, maarten van damme via
Digitalmars-d-learn wrote:
an anyone explain me what I'm doing wrong here :
[code]
dstring[][dstring] providor_symbol_map;
...
writeln(providor_symbol_map.keys.sort!((x,y)=>providor_symbol_map[x].length>=providor_symbol_map[y].len
Sorry about typo, I meant
providor_symbol_map.sort!((x,y)=>{x.value.length>y.value.length})
above.
Aha, so you want to maintain "spam word" -> "set of senders"
relationship, so it's actually "map of sets" and your declaration
is correct. You only need to sort map's entries (key and value
pairs together).
If D supports that, it should be something like
providor_symbol_map.sort!((x,y)=>{x.va
I must note if the sequence is predictable, it's not random
anymore, it's pseudo-random at most.
Also, if anyone interested, PHP had such way to generate
predictable sequences in the past, but after it was horribly
misused by various people for crypto keys/password generation
purposes, they h
The General rule is not to compare floats for equality, (is
0.0==-0.0, etc.). Use a epsilon based comparision scheme
instead or a wrapper around it.
That's not exactly true. You cannot (and should not) compare
floating points for equality, and use epsilon-based comparison
instead, only in one
12 matches
Mail list logo