[armedbear-devel] CL:SLEEP fixed for sub-millisecond intervals

Mark Evenson evenson at panix.com
Tue Mar 25 09:26:35 UTC 2014


On Mar 24, 2014, at 19:55, James M. Lawrence <llmjjmll at gmail.com> wrote:

[…]

> On your end, I think you just need to avoid rounding a non-zero value
> to zero. If the reader rounds a literal to zero then there's nothing
> you can do, but 0.000000001 is well before that problem. The
> separation of the reader phase in Lisp does not mix well with the
> extreme discontinuity between 0 and non-zero values with TIMED-WAIT.

I am very much in agreement that the discontinuity is not a very good API choice on the JVM’s part.  

The problem lies in the fact JVM interfaces to thread sleeping [and waiting][1] specify timeouts as integers, so I *have* to do some interpolation for non-zero user values of intervals less than a nanosecond (the “Planck unit” for JVM times).

[1]: http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-

So, in order to implement 

> I need to add a workaround to the ABCL implementation of
> bordeaux-threads:condition-wait. If the user passes a timeout of zero
> then the this should translate to TIMED-WAIT of
> LEAST-POSITIVE-SINGLE-FLOAT.

I propose to interpolate non-zero values specified by the user of less than a nanosecond to CL:SLEEP/THREADS:OBJECT-WAIT to mean a sleep/wait for a nanosecond.  If the user specifies a zero-value, then she will get an infinite timeout.  

P.S. not sure what you mean by the “separation of the reader phase in Lisp does not mix well…”.  What does the Lisp reader have to do with the discontinuity of the API? 

Thanks for the feedback:  we’ll get this fixed to your satisfaction (modulo the “brokenness” of the JVM) for abcl-1.3.1!

-- 
"A screaming comes across the sky.  It has happened before but there is nothing 
to compare to it now."








More information about the armedbear-devel mailing list