Thread overview
[Issue 5438] New: Thread.sleep doesn't sleep
Apr 15, 2011
Pedro Rodrigues
January 09, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5438

           Summary: Thread.sleep doesn't sleep
           Product: D
           Version: D2
          Platform: Other
               URL: http://www.digitalmars.com/d/2.0/phobos/std_thread.htm
                    l
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: eatingstaples@gmail.com


--- Comment #0 from eatingstaples@gmail.com 2011-01-09 06:57:58 PST ---
Created an attachment (id=866)
Code demonstrating the issue

Calling Thread.sleep does not suspend the calling thread for the time supplied; the call returns immediately.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 15, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5438


Pedro Rodrigues <pdfrodrigues@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pdfrodrigues@gmail.com


--- Comment #1 from Pedro Rodrigues <pdfrodrigues@gmail.com> 2011-04-15 07:09:38 PDT ---
According to the documentation of Thread.sleep it receives as argument "The
minimum duration the calling thread should be suspended, in 100 nanosecond
intervals.".
That means that calling with value 10_000 will sleep for 1 millisecond, which
is too small to be noticeable. I tried with 100_000_000 (10 seconds) in DMD
v2.052 and it seemed to be working as expected.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 15, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5438


Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |schveiguy@yahoo.com
         Resolution|                            |WORKSFORME


--- Comment #2 from Steven Schveighoffer <schveiguy@yahoo.com> 2011-04-15 07:43:16 PDT ---
This bug needs more details, as to exactly what is expected to happen.  Not having any details, I can't tell what exactly you expect should happen.

I'm closing this, if you feel it was closed in error, please reopen with more details.  Specifically, you should outline what the behavior currently is, and what behavior you expect.  Also, any evidence showing the erroneous behavior would be appreciated.

As a tip, Thread.sleep now accepts a core.time.Duration struct, which can be initialized with units other than hnsecs.

e.g.

Thread.sleep(dur!"seconds"(5)); // sleep for 5 seconds

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