Hi Alexander,

On Jun 2, 2012, at 1:01 PM, Alexander Burger wrote:
> 
>   (task -2000 0                                # Run once every 2 sec
>      Slots (need 4 "free")                     # QuadCore
>      (map
>         '((Pos)
>            (cond
>               ((== "free" (car Pos))           # Found a free slot
>                  (when (fifo '*Batch)          # Any jobs?
>                     (set Pos "busy")           # Yes
>                     (later Pos (eval @)) ) )
>               ((n== "busy" (car Pos))          # Found a result
>                  (msg (car Pos))               # Handle result
>                  (ifn (fifo '*Batch)           # More jobs?
>                     (set Pos "free")           # No
>                     (set Pos "busy")           # Yes
>                     (later Pos (eval @)) ) ) ) )
>         Slots ) )

OK, if I understood 'task' correctly this runs entirely on the 'main' process 
(the one that will be accessing the database and queueing the commands).
Looks like if the main process is busy in a very CPU-intensive task (no IO at 
all) it could be missing some chances to launch additional processes, but I 
guess I can workaround that inserting a (wait 0) at some point in the expensive 
calculation to give the task a chance to run, right?
This is perfect, nice and simple.

Thanks,
  Jorge


--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to