Skip to content

cgc1983/levent

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

levent

levent is a lua concurrency networking library inspired by gevent.

Features include:

  • Fast event loop based on libev.
  • Simple and clean socket library
  • Cooperative dns client by pure lua
  • Similar api and components with gevent but with much more simpler implementation and better performance.

levent is licensed under MIT license.

get levent

Install lua 5.2 or newer.

Clone the repository.

Read test case and examples.

Post feedback and issues on the bug tracker,

build

need cmake 2.8 or newer.

cmake .
make

ways to build on windows, ref to blog

code example

levent's api is clean, below is a code example for how to run a time limit work

lua <<SCRIPT
local levent  = require "levent.levent"
local timeout = require "levent.timeout"

function main()
    print("work 1:", timeout.run(0.2, levent.sleep, 0.1))
    print("work 2:", timeout.run(0.1, levent.sleep, 0.2))
end
levent.start(main)
SCRIPT

running tests

there are some tests and examples under tests and examples to illustrate how to use levent, you can run tests and examples from root folder of levent as below.

lua tests/test_socket.lua
lua examples/dns_mass_resolve.lua

documents

coming soon~~

licence

The MIT License (MIT) Copyright (c) 2014 xjdrew

About

lua concurrency library based on libev, similar with gevent

Resources

License

Stars

Watchers

Forks

Packages

No packages published