[racket] values primitive blocks future execution

From: Dmitry Cherkassov (dcherkassov at gmail.com)
Date: Thu Feb 21 16:03:28 EST 2013

Hi list.
I've been doing a simple ray tracer[1] and decided to parallelize it using
futures.

I've tried to use flonums everywhere and added (in-range) to loops [3]
(over x and y coordinates).

The problem is that execution of future is blocked seriously.
(apparently by the value primitive) [2]

Are there any ideas why it doesn't work?

I use racket v5.3.3.

[1] Complete source code: http://pastebin.com/EGSzR1Tv

[2] Future visualizer screenshot: http://ompldr.org/vaGpiaQ
    Invoked via
    (require future-visualizer)
    (visualize-futures (run-no-render))

[3] Source code for main loop:
(define (render-scene-dummy object-list)
  (let* ([f (future
           (lambda ()
             (for* ([x (in-range (/ screen-width 2))]
                    [y (in-range screen-height)])
               (let* ([ray-res (ray-cast x y object-list)]
                      [pix-col (point-col (int-res-p ray-res))])
                 #t))
             ))])

    (for* ([x (in-range (/ screen-width 2) screen-width)]
           [y (in-range screen-height)])
      (let* ([ray-res (ray-cast x y object-list)]
             [pix-col (point-col (int-res-p ray-res))])
        #t))
    (touch f)))



-- 
With best regards,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130222/6e2262a8/attachment.html>

Posted on the users mailing list.