Re: More accurate wording for java.util.concurrent.TimeUnit.sleep

David Holmes via Concurrency-interest <[email protected]>
Newsgroups gmane.comp.java.jsr.166-concurrency
Message-ID <[email protected]>
Martin,

 

I think we took the opportunity with TimeUnit to tighten up the loose specs from Thread.sleep. So I’m happy for TimeUnit to specify that <=0 is a no-op rather than some vague system level thing that may or may not actually have an observable affect.

 

Cheers,

David

 

From: Concurrency-interest On Behalf Of Martin Buchholz via Concurrency-interest
Sent: Saturday, August 31, 2019 3:00 AM
To: Pavel Rappo <[email protected]>
Cc: concurrency-interest <[email protected]>; David Holmes <[email protected]>
Subject: Re: [concurrency-interest] More accurate wording for java.util.concurrent.TimeUnit.sleep

 

I've been a steady advocate of "at least" semantics for methods that specify a duration, including sleep.

 

https://bugs.openjdk.java.net/browse/JDK-6313903 <https://bugs.openjdk.java.net/browse/JDK-6313903?filter=25118> 

 

Pavel, if you need to do something surely at 9am, set the alarm for 8am, not 9am!

 

I agree that if Thread.sleep(0) is not really a no-op then TimeUnit.sleep(0) should do the same thing.  Doug?

_______________________________________________
Concurrency-interest mailing list
[email protected]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.