[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: another try at multithreading
- From: "Javier Guerra" <javier@...>
- Date: Wed, 25 Jun 2008 16:18:37 -0500
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