Bug 3859 – 100% CPU with thread in a loop

Status
RESOLVED
Resolution
INVALID
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2010-02-27T02:17:00Z
Last change time
2014-04-18T09:12:03Z
Assigned to
nobody
Creator
bremby

Comments

Comment #0 by bremby — 2010-02-27T02:17:30Z
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.