Bug 5438 – Thread.sleep doesn't sleep

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-01-09T06:57:00Z
Last change time
2011-04-15T07:43:16Z
Assigned to
nobody
Creator
eatingstaples

Attachments

IDFilenameSummaryContent-TypeSize
866main.dCode demonstrating the issueapplication/octet-stream66

Comments

Comment #0 by eatingstaples — 2011-01-09T06:57:58Z
Created attachment 866 Code demonstrating the issue Calling Thread.sleep does not suspend the calling thread for the time supplied; the call returns immediately.
Comment #1 by pedro — 2011-04-15T07:09:38Z
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.
Comment #2 by schveiguy — 2011-04-15T07:43:16Z
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