[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Basic Lanes question
- From: Benoit Germain <bnt.germain@...>
- Date: Tue, 15 Nov 2011 17:04:06 +0100
2011/11/15 Thijs Koerselman <thijskoerselman@gmail.com>:
> I am trying to create two free running processes in parallel, like this:
> lanes.gen(function() os.execute('sleep 10 && echo finished_sleeping') end)()
> lanes.gen(function() os.execute('sleep 10 && echo finished_sleeping') end)()
> This however takes 20 seconds. Why is that and what am I doing wrong?
> Thijs
I've checked with lanes HEAD, and it works as expected, all threads
are run concurrently. You seem to be running a lanes-2.x version. I am
pretty sure it should behave the same though. Here is what I get:
local lanes = require "lanes".configure(1)
print( os.date())
lanes.gen("os,base", function() os.execute('sleep 10 && echo
finished_sleeping') print( os.date()) end)()
lanes.gen("os,base", function() os.execute('sleep 10 && echo
finished_sleeping') print( os.date()) end)()
lanes.gen("os,base", function() os.execute('sleep 10 && echo
finished_sleeping') print( os.date()) end)()
lanes.gen("os,base", function() os.execute('sleep 10 && echo
finished_sleeping') print( os.date()) end)()
->
> dofile "lanes_test.lua"
11/15/11 17:02:26
> finished_sleeping
finished_sleeping
finished_sleeping
11/15/11 17:02:36
11/15/11 17:02:36
finished_sleeping
11/15/11 17:02:36
11/15/11 17:02:36
--
Benoit.