lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, Jun 25, 2008 at 4:04 PM, Augusto Radtke <radtke@radtke.com.br> wrote:
> parallel do
>    a = a + 1  -- This will run in the first core.
>    b = b + 1  -- This will run in the next available core and could start
> before the first chunk finished, if the first chunk is too slow.
>    c = c + 1  -- This will run in the next available core and the same.
>    d = d + 1  -- This will run in the next available core and the same.
> end

you're splitting each statement in the block?  can't see how that
could be usefull, unless it's almost mandatory to make it just a
sequence of function calls, in that case, it could be done like that:

parallel.do {
   function() a=a+1 end,
   function() b=b+1 end,
   function() c=c+1 end,
   function() d=d+1 end
}

of course, with non-trivial functions that wouldn't look so ugly.

-- 
Javier