Assert in child thread exits without error message?
FinalEvilution
FinalEvilution at gmail.com
Thu Jun 4 10:34:59 UTC 2026
I've tested
dmd master 193230b
dmd v2.112.1
ldc 1.42.0
ldc 1.41.0
ldc 1.36.0
ldc 1.32.2
on linux and all of them exit the child thread without an error
message.
I would think that this is a bug.
But this seems like this has been around for a while and so I'm a
little confused
as I'd think someone other than me would have tripped over this
by now.
```d
import std.concurrency;
import std.stdio : writeln;
void main(string[] args)
{
Tid thread = spawn(&workerThread);
// assert(false); // This works.
// User input so this can't be ctfe.
send(thread, args.length);
receive((Tid tid) {});
}
void workerThread()
{
size_t index;
receive((size_t inIndex) {index = inIndex;});
writeln("before");
assert(index == 9999); // This just exits.
writeln("after");
send(ownerTid(), thisTid());
}
```
More information about the Digitalmars-d-learn
mailing list