← Back to index
|
Original Bugzilla link
Bug 15294 – receiveTimeout with negative value asserts
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2015-11-05T23:25:39Z
Last change time
2018-03-31T18:18:31Z
Assigned to
No Owner
Creator
Justin Whear
Comments
Comment #0
by justin — 2015-11-05T23:25:39Z
std.concurrency.receiveTimeout claims to not wait if the provided Duration is negative, but an assert trips if a negative value is supplied. > cat test.d void main() { import std.concurrency; import core.time; auto dontWait = dur!"msecs"(-1); spawn(&foo); receiveTimeout(dontWait, (int i){}); } void foo() {} Using DMD 2.069.0: > dmd test.d > ./test core.exception.AssertError@std/concurrency.d(1910): Assertion failure ---------------- ??:? _d_assert [0x4518f7] ??:? void std.concurrency.__assert(int) [0x459354] ??:? bool std.concurrency.MessageBox.get!(core.time.Duration, pure nothrow @nogc @safe void function(int)*).get(scope core.time.Duration, scope pure nothrow @nogc @safe void function(int)*) [0x441614] ??:? bool std.concurrency.receiveTimeout!(pure nothrow @nogc @safe void function(int)*).receiveTimeout(core.time.Duration, pure nothrow @nogc @safe void function(int)*) [0x441595] ??:? _Dmain [0x4413c7] ??:? _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv [0x455f5a] ??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x455eb0] ??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() [0x455f16] ??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x455eb0] ??:? _d_run_main [0x455e0d] ??:? main [0x44ed7d] ??:? __libc_start_main [0x82126b44] Here is the problematic line:
https://github.com/D-Programming-Language/phobos/blob/master/std/concurrency.d#L1910
Comment #1
by greensunny12 — 2018-03-31T18:18:31Z
This has been fixed in 2.072:
https://run.dlang.io/is/FlTlZj