[racket] thread execution granularity?
I just tried this program:
#lang racket/base
(define times '())
(define start (current-inexact-milliseconds))
(for ([x (in-range 10)])
(set! times (cons (- (current-inexact-milliseconds) start) times))
(sleep 0.01))
and times was bound to:
'(90.0 80.0 70.0 60.0 50.0 40.0 30.0 20.0 10.0 0.0)
so hopefully that suggests that whatever you read was wrong.
Speaking of which, I couldn't find that in the docs. Where did you read that?
Robby
On Fri, Feb 17, 2012 at 8:04 AM, Rüdiger Asche <rac at ruediger-asche.de> wrote:
> according to the Racket docs, the smallest amount of time a thread can be
> put to sleep is 1 second. I need a finer granularity than that... if I had
> access to the thread priority, I might just have the thread poll the timer
> on low priority, but I haven't found a way to do that.
>
> What I need to do eventually is call some (simple, mutual exclusion is not
> an issue) code periodically but in a complex application context. I can't
> rely on the application to do that cooperatively, so it must take place in a
> secondary thread, but the period must be smaller than a second (ideally I
> would be able to go down to millisecond granularity but if necessary
> something like 50 ms would suffice).
>
> Any ideas how to accomplish that?
>
> Thanks!
>
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users