Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
16
Task/Concurrent-computing/Lua/concurrent-computing.lua
Normal file
16
Task/Concurrent-computing/Lua/concurrent-computing.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
co = {}
|
||||
co[1] = coroutine.create( function() print "Enjoy" end )
|
||||
co[2] = coroutine.create( function() print "Rosetta" end )
|
||||
co[3] = coroutine.create( function() print "Code" end )
|
||||
|
||||
math.randomseed( os.time() )
|
||||
h = {}
|
||||
i = 0
|
||||
repeat
|
||||
j = math.random(3)
|
||||
if h[j] == nil then
|
||||
coroutine.resume( co[j] )
|
||||
h[j] = true
|
||||
i = i + 1
|
||||
end
|
||||
until i == 3
|
||||
Loading…
Add table
Add a link
Reference in a new issue