Skip to content
/ l3c Public

Lua concurrency using channels and coroutines

License

Notifications You must be signed in to change notification settings

akapav/l3c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

L3C - Lua concurrency using channels and coroutines

L3C is Lua library for concurrent programming. It's two basic concurrency primitives are lightweight cooperative threads and communication channels.

The project is under heavy development.

Example:

local function to(ch1, ch2)
   while true do
      local x = recv(ch1)
      send(ch2, x + 1)
   end
end

local function from()
   local ch1 = chan()
   local ch2 = chan()

   local ch3 = chan()
   local ch4 = chan()
   
   go (to, ch1, ch2)
   go (to, ch3, ch4)

   local x = 0
   send(ch1, x)
   while x < 20 do
      x = recv(ch2)
      print (x)
      send(ch3, x)
      x = recv(ch4)
      print (x)
      send(ch1, x)
   end
end

run (from)

About

Lua concurrency using channels and coroutines

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages