프로젝트
GitHub에서 보기
cloudwu/ltask
소개
또 하나의 Lua 작업 라이브러리이자 n:m 스케줄러입니다.
개발 도구측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Originalltask: Yet another lua task library
ltask is inspired by skynet (https://github.com/cloudwu/skynet) , but it's a library rather than a framework.
It implement an n:m scheduler , so that you can run M lua VMs on N OS threads.
Each lua service (an independent lua VM) works in request/response mode, they use message channels to inter-communicate.
root is a special service that can spawn new services. For example,
-- user
local ltask = require "ltask"
local S = {}
print "User Start"
function S.ping(...)
ltask.timeout(10, function() print(1) end)
ltask.timeout(20, function() print(2) end)
ltask.timeout(30, function() print(3) end)
ltask.sleep(40) -- sleep 0.4 sec
-- response
return "PING", ...
end
return S
-- root
local function boot()
print "Root Start"
print(os.date("%c", (ltask.now())))
local addr = S.spawn("user", "Hello") -- spawn a new service `user`
print(ltask.call(addr, "ping", "PONG")) -- request "ping" message
end
boot()
Test
lua test.lua
관련 프로젝트 살펴보기
불러오는 중…