www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3859] New: 100% CPU with thread in a loop

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3859

           Summary: 100% CPU with thread in a loop
           Product: D
           Version: 1.053
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bremby seznam.cz



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().

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 27 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3859





 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. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 27 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3859


Martin Krejcirik <mk krej.cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |mk krej.cz
         Resolution|                            |INVALID



Cannot reproduce on both linux and windows DMD 1.076 32bit

Marking as INVALID.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 01 2013