[concurrency-interest] deadline and long overflow

Alex Otenko oleksandr.otenko at gmail.com
Wed Apr 20 06:32:26 EDT 2016


Wouldn’t that be a deadline of 500-odd years?

Technically, overflow is a possibility. Practically - very unlikely.

Alex

> On 20 Apr 2016, at 11:05, Peter Veentjer <alarmnummer at gmail.com> wrote:
> 
> I have a question regarding dealing with deadlines and long overflow.
> 
> For example the following from the SynchronousQueue:
> 
> final long deadline = timed ? System.nanoTime() + nanos : 0L;
> What would happen if someone calls queue.offer(item, Long.MAX_VALUE, NANOS) then deadline overflows and becomes negative. I see the same approach in other parts e.g. 
> 
> this.deadline = timed ? System.nanoTime() + nanos : 0L;
> from the Phaser. Personally I like the simplicity; but my concern is regarding validity.
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20160420/fda59992/attachment.html>


More information about the Concurrency-interest mailing list