Merge branch 'v15.3.0' into 15.3.0-SystemThreadedConnections
This commit is contained in:
commit
23eaf42cad
3
.gitignore
vendored
3
.gitignore
vendored
@ -4,4 +4,5 @@
|
|||||||
*lua5.4
|
*lua5.4
|
||||||
*luajit
|
*luajit
|
||||||
*.code-workspace
|
*.code-workspace
|
||||||
*.dat
|
*.dat
|
||||||
|
*.zip
|
||||||
@ -21,7 +21,10 @@ Link to optional dependencies:
|
|||||||
|
|
||||||
To install copy the multi folder into your environment and you are good to go</br>
|
To install copy the multi folder into your environment and you are good to go</br>
|
||||||
If you want to use the system threads, then you'll need to install lanes or love2d game engine!
|
If you want to use the system threads, then you'll need to install lanes or love2d game engine!
|
||||||
**or** use luarocks `luarocks install multi`
|
|
||||||
|
```
|
||||||
|
luarocks install multi
|
||||||
|
```
|
||||||
|
|
||||||
Discord
|
Discord
|
||||||
-------
|
-------
|
||||||
|
|||||||
@ -34,7 +34,7 @@ if not _G["$multi"] then
|
|||||||
_G["$multi"] = {multi=multi,thread=thread}
|
_G["$multi"] = {multi=multi,thread=thread}
|
||||||
end
|
end
|
||||||
|
|
||||||
multi.Version = "15.2.0"
|
multi.Version = "15.3.0"
|
||||||
multi.Name = "root"
|
multi.Name = "root"
|
||||||
multi.NIL = {Type="NIL"}
|
multi.NIL = {Type="NIL"}
|
||||||
local NIL = multi.NIL
|
local NIL = multi.NIL
|
||||||
@ -1478,6 +1478,7 @@ co_status = {
|
|||||||
["normal"] = function(thd,ref) end,
|
["normal"] = function(thd,ref) end,
|
||||||
["running"] = function(thd,ref) end,
|
["running"] = function(thd,ref) end,
|
||||||
["dead"] = function(thd,ref,task,i,th)
|
["dead"] = function(thd,ref,task,i,th)
|
||||||
|
if ref.__processed then return end
|
||||||
if _ then
|
if _ then
|
||||||
ref.OnDeath:Fire(ret,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16)
|
ref.OnDeath:Fire(ret,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16)
|
||||||
else
|
else
|
||||||
@ -1494,6 +1495,7 @@ co_status = {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
_=nil r1=nil r2=nil r3=nil r4=nil r5=nil
|
_=nil r1=nil r2=nil r3=nil r4=nil r5=nil
|
||||||
|
ref.__processed = true
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
handler = coroutine.wrap(function(self)
|
handler = coroutine.wrap(function(self)
|
||||||
|
|||||||
@ -139,19 +139,19 @@ function multi.InitSystemThreadErrorHandler()
|
|||||||
elseif status == "error" then
|
elseif status == "error" then
|
||||||
livingThreads[temp.Id] = {false, temp.Name}
|
livingThreads[temp.Id] = {false, temp.Name}
|
||||||
temp.alive = false
|
temp.alive = false
|
||||||
temp.OnError:Fire(temp,nil,unpack(temp.returns:receive(0,"returns") or {"Thread Killed!"}))
|
temp.OnError:Fire(temp,unpack(temp.returns:receive(0,"returns") or {"Thread Killed!"}))
|
||||||
GLOBAL["__THREADS__"] = livingThreads
|
GLOBAL["__THREADS__"] = livingThreads
|
||||||
table.remove(threads, i)
|
table.remove(threads, i)
|
||||||
elseif status == "cancelled" then
|
elseif status == "cancelled" then
|
||||||
livingThreads[temp.Id] = {false, temp.Name}
|
livingThreads[temp.Id] = {false, temp.Name}
|
||||||
temp.alive = false
|
temp.alive = false
|
||||||
temp.OnError:Fire(temp,nil,"thread_cancelled")
|
temp.OnError:Fire(temp,"thread_cancelled")
|
||||||
GLOBAL["__THREADS__"] = livingThreads
|
GLOBAL["__THREADS__"] = livingThreads
|
||||||
table.remove(threads, i)
|
table.remove(threads, i)
|
||||||
elseif status == "killed" then
|
elseif status == "killed" then
|
||||||
livingThreads[temp.Id] = {false, temp.Name}
|
livingThreads[temp.Id] = {false, temp.Name}
|
||||||
temp.alive = false
|
temp.alive = false
|
||||||
temp.OnError:Fire(temp,nil,"thread_killed")
|
temp.OnError:Fire(temp,"thread_killed")
|
||||||
GLOBAL["__THREADS__"] = livingThreads
|
GLOBAL["__THREADS__"] = livingThreads
|
||||||
table.remove(threads, i)
|
table.remove(threads, i)
|
||||||
end
|
end
|
||||||
|
|||||||
39
rockspecs/multi-15.2-1.rockspec
Normal file
39
rockspecs/multi-15.2-1.rockspec
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package = "multi"
|
||||||
|
version = "15.2-1"
|
||||||
|
source = {
|
||||||
|
url = "git://github.com/rayaman/multi.git",
|
||||||
|
tag = "v15.2.1",
|
||||||
|
}
|
||||||
|
description = {
|
||||||
|
summary = "Lua Multi tasking library",
|
||||||
|
detailed = [[
|
||||||
|
This library contains many methods for multi tasking. Features non coroutine based multi-tasking, coroutine based multi-tasking, and system threading (Requires use of an integration).
|
||||||
|
Check github for documentation.
|
||||||
|
]],
|
||||||
|
homepage = "https://github.com/rayaman/multi",
|
||||||
|
license = "MIT"
|
||||||
|
}
|
||||||
|
dependencies = {
|
||||||
|
"lua >= 5.1"
|
||||||
|
}
|
||||||
|
build = {
|
||||||
|
type = "builtin",
|
||||||
|
modules = {
|
||||||
|
["multi"] = "multi/init.lua",
|
||||||
|
["multi.integration.lanesManager"] = "multi/integration/lanesManager/init.lua",
|
||||||
|
["multi.integration.lanesManager.extensions"] = "multi/integration/lanesManager/extensions.lua",
|
||||||
|
["multi.integration.lanesManager.threads"] = "multi/integration/lanesManager/threads.lua",
|
||||||
|
["multi.integration.loveManager"] = "multi/integration/loveManager/init.lua",
|
||||||
|
["multi.integration.loveManager.extensions"] = "multi/integration/loveManager/extensions.lua",
|
||||||
|
["multi.integration.loveManager.threads"] = "multi/integration/loveManager/threads.lua",
|
||||||
|
--["multi.integration.lovrManager"] = "multi/integration/lovrManager/init.lua",
|
||||||
|
--["multi.integration.lovrManager.extensions"] = "multi/integration/lovrManager/extensions.lua",
|
||||||
|
--["multi.integration.lovrManager.threads"] = "multi/integration/lovrManager/threads.lua",
|
||||||
|
["multi.integration.pesudoManager"] = "multi/integration/pesudoManager/init.lua",
|
||||||
|
["multi.integration.pesudoManager.extensions"] = "multi/integration/pesudoManager/extensions.lua",
|
||||||
|
["multi.integration.pesudoManager.threads"] = "multi/integration/pesudoManager/threads.lua",
|
||||||
|
["multi.integration.luvitManager"] = "multi/integration/luvitManager.lua",
|
||||||
|
["multi.integration.threading"] = "multi/integration/threading.lua",
|
||||||
|
--["multi.integration.networkManager"] = "multi/integration/networkManager.lua",
|
||||||
|
}
|
||||||
|
}
|
||||||
39
rockspecs/multi-15.3-0.rockspec
Normal file
39
rockspecs/multi-15.3-0.rockspec
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package = "multi"
|
||||||
|
version = "15.3-0"
|
||||||
|
source = {
|
||||||
|
url = "git://github.com/rayaman/multi.git",
|
||||||
|
tag = "v15.3.0",
|
||||||
|
}
|
||||||
|
description = {
|
||||||
|
summary = "Lua Multi tasking library",
|
||||||
|
detailed = [[
|
||||||
|
This library contains many methods for multi tasking. Features non coroutine based multi-tasking, coroutine based multi-tasking, and system threading (Requires use of an integration).
|
||||||
|
Check github for documentation.
|
||||||
|
]],
|
||||||
|
homepage = "https://github.com/rayaman/multi",
|
||||||
|
license = "MIT"
|
||||||
|
}
|
||||||
|
dependencies = {
|
||||||
|
"lua >= 5.1"
|
||||||
|
}
|
||||||
|
build = {
|
||||||
|
type = "builtin",
|
||||||
|
modules = {
|
||||||
|
["multi"] = "multi/init.lua",
|
||||||
|
["multi.integration.lanesManager"] = "multi/integration/lanesManager/init.lua",
|
||||||
|
["multi.integration.lanesManager.extensions"] = "multi/integration/lanesManager/extensions.lua",
|
||||||
|
["multi.integration.lanesManager.threads"] = "multi/integration/lanesManager/threads.lua",
|
||||||
|
["multi.integration.loveManager"] = "multi/integration/loveManager/init.lua",
|
||||||
|
["multi.integration.loveManager.extensions"] = "multi/integration/loveManager/extensions.lua",
|
||||||
|
["multi.integration.loveManager.threads"] = "multi/integration/loveManager/threads.lua",
|
||||||
|
--["multi.integration.lovrManager"] = "multi/integration/lovrManager/init.lua",
|
||||||
|
--["multi.integration.lovrManager.extensions"] = "multi/integration/lovrManager/extensions.lua",
|
||||||
|
--["multi.integration.lovrManager.threads"] = "multi/integration/lovrManager/threads.lua",
|
||||||
|
["multi.integration.pesudoManager"] = "multi/integration/pesudoManager/init.lua",
|
||||||
|
["multi.integration.pesudoManager.extensions"] = "multi/integration/pesudoManager/extensions.lua",
|
||||||
|
["multi.integration.pesudoManager.threads"] = "multi/integration/pesudoManager/threads.lua",
|
||||||
|
["multi.integration.luvitManager"] = "multi/integration/luvitManager.lua",
|
||||||
|
["multi.integration.threading"] = "multi/integration/threading.lua",
|
||||||
|
--["multi.integration.networkManager"] = "multi/integration/networkManager.lua",
|
||||||
|
}
|
||||||
|
}
|
||||||
5
test.lua
5
test.lua
@ -1,6 +1,7 @@
|
|||||||
package.path = "./?/init.lua;"..package.path
|
package.path = "./?/init.lua;?.lua;lua5.4/share/lua/?/init.lua;lua5.4/share/lua/?.lua;"..package.path
|
||||||
|
package.cpath = "lua5.4/lib/lua/?/core.dll;"..package.cpath
|
||||||
multi, thread = require("multi"):init{print=true}
|
multi, thread = require("multi"):init{print=true}
|
||||||
GLOBAL, THREAD = require("multi.integration.threading"):init()
|
GLOBAL, THREAD = require("multi.integration.lanesManager"):init()
|
||||||
|
|
||||||
function multi:newSystemThreadedConnection()
|
function multi:newSystemThreadedConnection()
|
||||||
--
|
--
|
||||||
|
|||||||
51
test3.lua
51
test3.lua
@ -1,51 +0,0 @@
|
|||||||
package.path = "./?.lua;?/init.lua;"..package.path
|
|
||||||
local multi,thread = require("multi"):init{print=true}
|
|
||||||
--local GLOBAL,THREAD = require("multi.integration.lanesManager"):init()
|
|
||||||
|
|
||||||
-- func = THREAD:newFunction(function(a,b,c)
|
|
||||||
-- print("Hello Thread!",a,b,c)
|
|
||||||
-- return 1,2,3
|
|
||||||
-- end)
|
|
||||||
|
|
||||||
-- func2 = THREAD:newFunction(function(a,b,c)
|
|
||||||
-- print("Hello Thread2!",a,b,c)
|
|
||||||
-- THREAD.sleep(1)
|
|
||||||
-- return 10,11,12
|
|
||||||
-- end)
|
|
||||||
|
|
||||||
-- multi:newThread("Test thread",function()
|
|
||||||
-- handler = func(4,5,6)
|
|
||||||
-- handler2 = func2(7,8,9)
|
|
||||||
-- thread.hold(handler.OnReturn + handler2.OnReturn)
|
|
||||||
-- print("Function Done",handler.getReturns())
|
|
||||||
-- print("Function Done",handler2.getReturns())
|
|
||||||
-- end)
|
|
||||||
|
|
||||||
|
|
||||||
-- multi:benchMark(1):OnBench(function(sec,steps)
|
|
||||||
-- print("Steps:",steps)
|
|
||||||
-- os.exit()
|
|
||||||
-- end)
|
|
||||||
print("Running benchmarks! ",_VERSION)
|
|
||||||
local sleep_for = 1
|
|
||||||
local a = 0
|
|
||||||
local c = 1
|
|
||||||
local function bench(t,step)
|
|
||||||
a = a + step
|
|
||||||
c = c + 1
|
|
||||||
os.exit()
|
|
||||||
end
|
|
||||||
--multi:benchMark(sleep_for,multi.Priority_Idle,"Idle:"):OnBench(bench)
|
|
||||||
--multi:benchMark(sleep_for,multi.Priority_Very_Low,"Very Low:"):OnBench(bench)
|
|
||||||
--multi:benchMark(sleep_for,multi.Priority_Low,"Low:"):OnBench()
|
|
||||||
--multi:benchMark(sleep_for,multi.Priority_Below_Normal,"Below Normal:"):OnBench(bench)
|
|
||||||
--multi:benchMark(sleep_for,multi.Priority_Normal,"Normal:"):OnBench(bench)
|
|
||||||
--multi:benchMark(sleep_for,multi.Priority_Above_Normal,"Above Normal:"):OnBench(bench)
|
|
||||||
--multi:benchMark(sleep_for,multi.Priority_High,"High:"):OnBench(bench)
|
|
||||||
--multi:benchMark(sleep_for,multi.Priority_Very_High,"Very High:"):OnBench(bench)
|
|
||||||
multi:benchMark(sleep_for,multi.Priority_Core,"Core:"):OnBench(bench)
|
|
||||||
multi.OnExit(function()
|
|
||||||
print("Total: ".. a)
|
|
||||||
end)
|
|
||||||
|
|
||||||
multi:mainloop()
|
|
||||||
Loading…
x
Reference in New Issue
Block a user