When I create a thread in a while loop, the first time it is created it works, the second time dual-core CPU gets up to 100% load and stucks in there. Tested with DMD 1.053. When compiled with latest GDC, only one core gets to 100%, the other one is fine.
Code:
class doNothing : Thread;
while(condition){
Thread test = new doNothing();
test.start;
test.wait(1000);
}
Reproducible: Always.
System: Ubuntu 9.10, x86, Core 2 Duo
The doNothing thread just wastes CPU cycles, I wrote it as a test for the wait() method. The test instance gets terminated after the second that is waited in wait().
Comment #1 by bremby — 2010-02-27T09:50:03Z
(In reply to comment #0)
> When I create a thread in a while loop, the first time it is created it works,
> the second time dual-core CPU gets up to 100% load and stucks in there. Tested
> with DMD 1.053. When compiled with latest GDC, only one core gets to 100%, the
> other one is fine.
>
Sorry, guys, I am an idiot - of course the CPU gets up to 100%, the class doNothing is written so. Anyway, the bug report is still valid: it never finishes a 2nd loop.
> Code:
>
> class doNothing : Thread;
>
> while(condition){
> Thread test = new doNothing();
> test.start;
> test.wait(1000);
++ writefln("1000 msec elapsed");
> }
>
> Reproducible: Always.
>
> System: Ubuntu 9.10, x86, Core 2 Duo
>
> The doNothing thread just wastes CPU cycles, I wrote it as a test for the
> wait() method. The test instance gets terminated after the second that is
> waited in wait().
The code prints out the text only once. It correctly waits 1000ms, prints out and then nothing happens ever again. Sorry for the messup.
Comment #2 by mk — 2013-04-01T10:09:58Z
Cannot reproduce on both linux and windows DMD 1.076 32bit
Marking as INVALID.