V15.3.0 #46

Merged
rayaman merged 85 commits from v15.3.0 into network_parallelism_test_branch 2022-06-11 23:41:07 -04:00
30 changed files with 186 additions and 233 deletions
Showing only changes of commit dff19d865f - Show all commits

View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2021 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
# Changelog # Changelog
Table of contents Table of contents
--- ---
[Update 15.1.0 - Hold the thread!](#update-1510---hold-the-thread)</br>[Update 15.0.0 - The art of faking it](#update-1500---the-art-of-faking-it)</br>[Update 14.2.0 - Bloatware Removed](#update-1420---bloatware-removed)</br>[Update 14.1.0 - A whole new world of possibilities](#update-1410---a-whole-new-world-of-possibilities)</br>[Update 14.0.0 - Consistency, Additions and Stability](#update-1400---consistency-additions-and-stability)</br>[Update 13.1.0 - Bug fixes and features added](#update-1310---bug-fixes-and-features-added)</br>[Update 13.0.0 - Added some documentation, and some new features too check it out!](#update-1300---added-some-documentation-and-some-new-features-too-check-it-out)</br>[Update 12.2.2 - Time for some more bug fixes!](#update-1222---time-for-some-more-bug-fixes)</br>[Update 12.2.1 - Time for some bug fixes!](#update-1221---time-for-some-bug-fixes)</br>[Update 12.2.0 - The chains of binding](#update-1220---the-chains-of-binding)</br>[Update 12.1.0 - Threads just can't hold on anymore](#update-1210---threads-just-cant-hold-on-anymore)</br>[Update: 12.0.0 - Big update (Lots of additions some changes)](#update-1200---big-update-lots-of-additions-some-changes)</br>[Update: 1.11.1 - Small Clarification on Love](#update-1111---small-clarification-on-love)</br>[Update: 1.11.0](#update-1110)</br>[Update: 1.10.0](#update-1100)</br>[Update: 1.9.2](#update-192)</br>[Update: 1.9.1 - Threads can now argue](#update-191---threads-can-now-argue)</br>[Update: 1.9.0](#update-190)</br>[Update: 1.8.7](#update-187)</br>[Update: 1.8.6](#update-186)</br>[Update: 1.8.5](#update-185)</br>[Update: 1.8.4](#update-184)</br>[Update: 1.8.3 - Mainloop recieves some needed overhauling](#update-183---mainloop-recieves-some-needed-overhauling)</br>[Update: 1.8.2](#update-182)</br>[Update: 1.8.1](#update-181)</br>[Update: 1.7.6](#update-176)</br>[Update: 1.7.5](#update-175)</br>[Update: 1.7.4](#update-174)</br>[Update: 1.7.3](#update-173)</br>[Update: 1.7.2](#update-172)</br>[Update: 1.7.1 - Bug Fixes Only](#update-171---bug-fixes-only)</br>[Update: 1.7.0 - Threading the systems](#update-170---threading-the-systems)</br>[Update: 1.6.0](#update-160)</br>[Update: 1.5.0](#update-150)</br>[Update: 1.4.1 (4/10/2017) - First Public release of the library](#update-141-4102017---first-public-release-of-the-library)</br>[Update: 1.4.0 (3/20/2017)](#update-140-3202017)</br>[Update: 1.3.0 (1/29/2017)](#update-130-1292017)</br>[Update: 1.2.0 (12.31.2016)](#update-120-12312016)</br>[Update: 1.1.0](#update-110)</br>[Update: 1.0.0](#update-100)</br>[Update: 0.6.3](#update-063)</br>[Update: 0.6.2](#update-062)</br>[Update: 0.6.1-6](#update-061-6)</br>[Update: 0.5.1-6](#update-051-6)</br>[Update: 0.4.1](#update-041)</br>[Update: 0.3.0 - The update that started it all](#update-030---the-update-that-started-it-all)</br>[Update: EventManager 2.0.0](#update-eventmanager-200)</br>[Update: EventManager 1.2.0](#update-eventmanager-120)</br>[Update: EventManager 1.1.0](#update-eventmanager-110)</br>[Update: EventManager 1.0.0 - Error checking](#update-eventmanager-100---error-checking)</br>[Version: EventManager 0.0.1 - In The Beginning things were very different](#version-eventmanager-001---in-the-beginning-things-were-very-different) [Update 15.2.0 - Upgrade Complete](#update-1520---upgrade-complete)</br>[Update 15.1.0 - Hold the thread!](#update-1510---hold-the-thread)</br>[Update 15.0.0 - The art of faking it](#update-1500---the-art-of-faking-it)</br>[Update 14.2.0 - Bloatware Removed](#update-1420---bloatware-removed)</br>[Update 14.1.0 - A whole new world of possibilities](#update-1410---a-whole-new-world-of-possibilities)</br>[Update 14.0.0 - Consistency, Additions and Stability](#update-1400---consistency-additions-and-stability)</br>[Update 13.1.0 - Bug fixes and features added](#update-1310---bug-fixes-and-features-added)</br>[Update 13.0.0 - Added some documentation, and some new features too check it out!](#update-1300---added-some-documentation-and-some-new-features-too-check-it-out)</br>[Update 12.2.2 - Time for some more bug fixes!](#update-1222---time-for-some-more-bug-fixes)</br>[Update 12.2.1 - Time for some bug fixes!](#update-1221---time-for-some-bug-fixes)</br>[Update 12.2.0 - The chains of binding](#update-1220---the-chains-of-binding)</br>[Update 12.1.0 - Threads just can't hold on anymore](#update-1210---threads-just-cant-hold-on-anymore)</br>[Update: 12.0.0 - Big update (Lots of additions some changes)](#update-1200---big-update-lots-of-additions-some-changes)</br>[Update: 1.11.1 - Small Clarification on Love](#update-1111---small-clarification-on-love)</br>[Update: 1.11.0](#update-1110)</br>[Update: 1.10.0](#update-1100)</br>[Update: 1.9.2](#update-192)</br>[Update: 1.9.1 - Threads can now argue](#update-191---threads-can-now-argue)</br>[Update: 1.9.0](#update-190)</br>[Update: 1.8.7](#update-187)</br>[Update: 1.8.6](#update-186)</br>[Update: 1.8.5](#update-185)</br>[Update: 1.8.4](#update-184)</br>[Update: 1.8.3 - Mainloop recieves some needed overhauling](#update-183---mainloop-recieves-some-needed-overhauling)</br>[Update: 1.8.2](#update-182)</br>[Update: 1.8.1](#update-181)</br>[Update: 1.7.6](#update-176)</br>[Update: 1.7.5](#update-175)</br>[Update: 1.7.4](#update-174)</br>[Update: 1.7.3](#update-173)</br>[Update: 1.7.2](#update-172)</br>[Update: 1.7.1 - Bug Fixes Only](#update-171---bug-fixes-only)</br>[Update: 1.7.0 - Threading the systems](#update-170---threading-the-systems)</br>[Update: 1.6.0](#update-160)</br>[Update: 1.5.0](#update-150)</br>[Update: 1.4.1 (4/10/2017) - First Public release of the library](#update-141-4102017---first-public-release-of-the-library)</br>[Update: 1.4.0 (3/20/2017)](#update-140-3202017)</br>[Update: 1.3.0 (1/29/2017)](#update-130-1292017)</br>[Update: 1.2.0 (12.31.2016)](#update-120-12312016)</br>[Update: 1.1.0](#update-110)</br>[Update: 1.0.0](#update-100)</br>[Update: 0.6.3](#update-063)</br>[Update: 0.6.2](#update-062)</br>[Update: 0.6.1-6](#update-061-6)</br>[Update: 0.5.1-6](#update-051-6)</br>[Update: 0.4.1](#update-041)</br>[Update: 0.3.0 - The update that started it all](#update-030---the-update-that-started-it-all)</br>[Update: EventManager 2.0.0](#update-eventmanager-200)</br>[Update: EventManager 1.2.0](#update-eventmanager-120)</br>[Update: EventManager 1.1.0](#update-eventmanager-110)</br>[Update: EventManager 1.0.0 - Error checking](#update-eventmanager-100---error-checking)</br>[Version: EventManager 0.0.1 - In The Beginning things were very different](#version-eventmanager-001---in-the-beginning-things-were-very-different)
# Update 15.2.0 - Upgrade Complete # Update 15.2.0 - Upgrade Complete
@ -26,7 +26,6 @@ Added:
Changed: Changed:
--- ---
- Connection Objects now pass on the parent object if created on a multiobj. This was to allow chaining to work properly with the new update - Connection Objects now pass on the parent object if created on a multiobj. This was to allow chaining to work properly with the new update
```lua ```lua
@ -76,7 +75,6 @@ Changed:
### Developer Note: ### Developer Note:
Connections are some of the most complex objects that this library has outside of some of the system threaded stuff. I tend to add features to connection objects quite often. Just last update connections can be "added" together creating a temp connection that only triggers when all of the added connections got triggered as well. Thinking about the possibilities this could give developers using the library I had to changed the base classes to use connections. Connections are some of the most complex objects that this library has outside of some of the system threaded stuff. I tend to add features to connection objects quite often. Just last update connections can be "added" together creating a temp connection that only triggers when all of the added connections got triggered as well. Thinking about the possibilities this could give developers using the library I had to changed the base classes to use connections.
The best part about this is that connections allow for greater control over an object's events. You can add and remove events that have been connected to as well as a lot of other things. Reference the documentation [here](./Documentation.md#non-actor-connections) The best part about this is that connections allow for greater control over an object's events. You can add and remove events that have been connected to as well as a lot of other things. Reference the documentation [here](./Documentation.md#non-actor-connections)
@ -84,6 +82,7 @@ The best part about this is that connections allow for greater control over an o
Removed: Removed:
--- ---
Nothing
Fixed: Fixed:
--- ---

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@ -1148,81 +1148,88 @@ function thread.pushStatus(...)
local t = thread.getRunningThread() local t = thread.getRunningThread()
t.statusconnector:Fire(...) t.statusconnector:Fire(...)
end end
function thread:newFunction(func,holdme) function thread:newFunctionBase(generator,holdme)
local tfunc = {} return function()
tfunc.Active = true local tfunc = {}
function tfunc:Pause() tfunc.Active = true
self.Active = false function tfunc:Pause()
end self.Active = false
function tfunc:Resume()
self.Active = true
end
function tfunc:holdMe(b)
holdme = b
end
local function noWait()
return nil, "Function is paused"
end
local rets, err
local function wait(no)
if thread.isThread() and not (no) then
return multi.hold(function()
if err then
return multi.NIL, err
elseif rets then
return cleanReturns((rets[1] or multi.NIL),rets[2],rets[3],rets[4],rets[5],rets[6],rets[7],rets[8],rets[9],rets[10],rets[11],rets[12],rets[13],rets[14],rets[15],rets[16])
end
end)
else
while not rets and not err do
multi.scheduler:Act()
end
if err then
return nil,err
end
return cleanReturns(rets[1],rets[2],rets[3],rets[4],rets[5],rets[6],rets[7],rets[8],rets[9],rets[10],rets[11],rets[12],rets[13],rets[14],rets[15],rets[16])
end end
end function tfunc:Resume()
tfunc.__call = function(t,...) self.Active = true
if not t.Active then end
if holdme then function tfunc:holdMe(b)
return nil, "Function is paused" holdme = b
end
local function noWait()
return nil, "Function is paused"
end
local rets, err
local function wait(no)
if thread.isThread() and not (no) then
return multi.hold(function()
if err then
return multi.NIL, err
elseif rets then
return cleanReturns((rets[1] or multi.NIL),rets[2],rets[3],rets[4],rets[5],rets[6],rets[7],rets[8],rets[9],rets[10],rets[11],rets[12],rets[13],rets[14],rets[15],rets[16])
end
end)
else
while not rets and not err do
multi.scheduler:Act()
end
if err then
return nil,err
end
return cleanReturns(rets[1],rets[2],rets[3],rets[4],rets[5],rets[6],rets[7],rets[8],rets[9],rets[10],rets[11],rets[12],rets[13],rets[14],rets[15],rets[16])
end end
return { end
tfunc.__call = function(t,...)
if not t.Active then
if holdme then
return nil, "Function is paused"
end
return {
isTFunc = true,
wait = noWait,
connect = function(f)
f(nil,"Function is paused")
end
}
end
local t = generator(...) --multi.getCurrentProcess():newThread("TempThread",func,...)
t.OnDeath(function(self,status,...) rets = {...} end)
t.OnError(function(self,e) err = e end)
if holdme then
return wait()
end
local temp = {
OnStatus = multi:newConnection(),
OnError = multi:newConnection(),
OnReturn = multi:newConnection(),
isTFunc = true, isTFunc = true,
wait = noWait, wait = wait,
connect = function(f) connect = function(f)
f(nil,"Function is paused") local tempConn = multi:newConnection()
t.OnDeath(function(self,status,...) if f then f(...) else tempConn:Fire(...) end end)
t.OnError(function(self,err) if f then f(nil,err) else tempConn:Fire(nil,err) end end)
return tempConn
end end
} }
t.OnDeath(function(self,status,...) temp.OnReturn:Fire(...) end)
t.OnError(function(self,err) temp.OnError:Fire(err) end)
t.linkedFunction = temp
t.statusconnector = temp.OnStatus
return temp
end end
local t = multi.getCurrentProcess():newThread("TempThread",func,...) setmetatable(tfunc,tfunc)
t.OnDeath(function(self,status,...) rets = {...} end) return tfunc
t.OnError(function(self,e) err = e end)
if holdme then
return wait()
end
local temp = {
OnStatus = multi:newConnection(),
OnError = multi:newConnection(),
OnReturn = multi:newConnection(),
isTFunc = true,
wait = wait,
connect = function(f)
local tempConn = multi:newConnection()
t.OnDeath(function(self,status,...) if f then f(...) else tempConn:Fire(...) end end)
t.OnError(function(self,err) if f then f(nil,err) else tempConn:Fire(nil,err) end end)
return tempConn
end
}
t.OnDeath(function(self,status,...) temp.OnReturn:Fire(...) end)
t.OnError(function(self,err) temp.OnError:Fire(err) end)
t.linkedFunction = temp
t.statusconnector = temp.OnStatus
return temp
end end
setmetatable(tfunc,tfunc) end
return tfunc function thread:newFunction(func,holdme)
return thread:newFunctionBase(function(...)
return multi.getCurrentProcess():newThread("TempThread",func,...)
end,holdme)()
end end
-- A cross version way to set enviroments, not the same as fenv though -- A cross version way to set enviroments, not the same as fenv though

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
]] ]]
package.path = "?/init.lua;?.lua;" .. package.path package.path = "?/init.lua;?.lua;" .. package.path
multi, thread = require("multi").init() -- get it all and have it on all lanes multi, thread = require("multi"):init() -- get it all and have it on all lanes
if multi.integration then -- This allows us to call the lanes manager from supporting modules without a hassle if multi.integration then -- This allows us to call the lanes manager from supporting modules without a hassle
return { return {
init = function() init = function()
@ -31,15 +31,18 @@ if multi.integration then -- This allows us to call the lanes manager from suppo
} }
end end
-- Step 1 get lanes -- Step 1 get lanes
lanes = require("lanes").configure() lanes = require("lanes").configure({allocator="protected",verbose_errors=""})
multi.SystemThreads = {} multi.SystemThreads = {}
multi.isMainThread = true multi.isMainThread = true
function multi:canSystemThread() function multi:canSystemThread()
return true return true
end end
function multi:getPlatform() function multi:getPlatform()
return "lanes" return "lanes"
end end
-- Step 2 set up the Linda objects -- Step 2 set up the Linda objects
local __GlobalLinda = lanes.linda() -- handles global stuff local __GlobalLinda = lanes.linda() -- handles global stuff
local __SleepingLinda = lanes.linda() -- handles sleeping stuff local __SleepingLinda = lanes.linda() -- handles sleeping stuff
@ -50,118 +53,50 @@ multi:newLoop(function()
print(unpack(data)) print(unpack(data))
end end
end) end)
local GLOBAL,THREAD = require("multi.integration.lanesManager.threads").init(__GlobalLinda,__SleepingLinda) local GLOBAL,THREAD = {},{}-- require("multi.integration.lanesManager.threads").init(__GlobalLinda,__SleepingLinda)
local threads = {}
local count = 1 local count = 1
local started = false local started = false
local livingThreads = {} local livingThreads = {}
local threads = {}
function THREAD:newFunction(func,holdme) function THREAD:newFunction(func,holdme)
local tfunc = {} return thread:newFunctionBase(function(...)
tfunc.Active = true return multi:newSystemThread("TempSystemThread",func,...)
function tfunc:Pause() end,holdme)()
self.Active = false
end
function tfunc:Resume()
self.Active = true
end
function tfunc:holdMe(b)
holdme = b
end
local function noWait()
return nil, "Function is paused"
end
local rets, err
local function wait(no)
if thread.isThread() and not (no) then
return multi.hold(function()
if err then
return nil, err
elseif rets then
return unpack(rets)
end
end)
else
while not rets and not err do
multi.scheduler:Act()
end
if err then
return nil,err
end
return unpack(rets)
end
end
tfunc.__call = function(t,...)
if not t.Active then
if holdme then
return nil, "Function is paused"
end
return {
isTFunc = true,
wait = noWait,
connect = function(f)
f(nil,"Function is paused")
end
}
end
local t = multi:newSystemThread("SystemThreadedFunction",func,...)
t.OnDeath(function(self,...) rets = {...} end)
t.OnError(function(self,e) err = e end)
if holdme then
return wait()
end
local temp = {
OnStatus = multi:newConnection(),
OnError = multi:newConnection(),
OnReturn = multi:newConnection(),
isTFunc = true,
wait = wait,
connect = function(f)
local tempConn = multi:newConnection()
t.OnDeath(function(self,...) if f then f(...) else tempConn:Fire(...) end end)
t.OnError(function(self,err) if f then f(nil,err) else tempConn:Fire(nil,err) end end)
return tempConn
end
}
t.OnDeath(function(self,...) temp.OnReturn:Fire(...) end)
t.OnError(function(self,err) temp.OnError:Fire(err) end)
t.linkedFunction = temp
t.statusconnector = temp.OnStatus
return temp
end
setmetatable(tfunc,tfunc)
return tfunc
end end
function multi:newSystemThread(name, func, ...) function multi:newSystemThread(name, func, ...)
multi.InitSystemThreadErrorHandler() --multi.InitSystemThreadErrorHandler()
rand = math.random(1, 10000000) local rand = math.random(1, 10000000)
local return_linda = lanes.linda()
local c = {} local c = {}
local __self = c
c.name = name c.name = name
c.Name = name c.Name = name
c.Id = count c.Id = count
c.loadString = {"base","package","os","io","math","table","string","coroutine"} c.loadString = {"base","package","os","io","math","table","string","coroutine"}
livingThreads[count] = {true, name} livingThreads[count] = {true, name}
c.returns = return_linda
c.Type = "sthread" c.Type = "sthread"
c.creationTime = os.clock() c.creationTime = os.clock()
c.alive = true c.alive = true
c.priority = THREAD.Priority_Normal c.priority = THREAD.Priority_Normal
local args = {...} c.thread = lanes.gen("*",
multi:newThread(function() {
c.thread = lanes.gen(table.concat(c.loadString,","), globals={ -- Set up some globals
{ THREAD_NAME = name,
globals={ -- Set up some globals THREAD_ID = count,
THREAD_NAME=name, THREAD = THREAD,
THREAD_ID=count, GLOBAL = GLOBAL,
THREAD = THREAD, _Console = __ConsoleLinda
GLOBAL = GLOBAL, },
_Console = __ConsoleLinda priority=c.priority
}, },function(...)
priority=c.priority local has_error = true
},func)(unpack(args)) return_linda:set("returns",{func(...)})
thread.kill() has_error = false
end) --error("thread killed")
print("Thread ending")
end)(...)
count = count + 1 count = count + 1
function c:kill() function c:kill()
self.thread:cancel() self.thread:cancel()
@ -171,61 +106,56 @@ function multi:newSystemThread(name, func, ...)
table.insert(multi.SystemThreads, c) table.insert(multi.SystemThreads, c)
c.OnDeath = multi:newConnection() c.OnDeath = multi:newConnection()
c.OnError = multi:newConnection() c.OnError = multi:newConnection()
GLOBAL["__THREADS__"] = livingThreads --GLOBAL["__THREADS__"] = livingThreads
return c return c
end end
local function detectLuaError(str)
return type(str)=="string" and str:match("%.lua:%d*:")
end
local function tableLen(tab)
local len = 0
for i,v in pairs(tab) do
len = len + 1
end
return len
end
function multi.InitSystemThreadErrorHandler() function multi.InitSystemThreadErrorHandler()
if started == true then if started == true then
return return
end end
started = true started = true
multi:newThread("ThreadErrorHandler",function() multi:newThread("SystemThreadScheduler",function()
local threads = multi.SystemThreads local threads = multi.SystemThreads
while true do while true do
thread.sleep(.1) -- switching states often takes a huge hit on performance. half a second to tell me there is an error is good enough. thread.sleep(.01) -- switching states often takes a huge hit on performance. half a second to tell me there is an error is good enough.
for i = #threads, 1, -1 do for i = #threads, 1, -1 do
local _,data = pcall(function() local status = threads[i].thread.status
return {threads[i].thread:join(1)} local temp = threads[i]
end) if status == "done" or temp.returns:get("returns") then
local v, err, t = data[1],data[2],data[3] livingThreads[temp.Id] = {false, temp.Name}
if detectLuaError(err) then temp.alive = false
if err:find("Thread was killed!\1") then temp.OnDeath:Fire(temp,nil,unpack(({temp.returns:receive(0, "returns")})[2]))
livingThreads[threads[i].Id] = {false, threads[i].Name} --GLOBAL["__THREADS__"] = livingThreads
threads[i].alive = false --print(temp.thread:cancel(10,true))
threads[i].OnDeath:Fire(threads[i],nil,"Thread was killed!") table.remove(threads, i)
GLOBAL["__THREADS__"] = livingThreads elseif status == "running" then
table.remove(threads, i) --
else elseif status == "waiting" then
threads[i].OnError:Fire(threads[i], err, "Error in systemThread: '" .. threads[i].name .. "' <" .. err .. ">") --
threads[i].alive = false elseif status == "error" then
livingThreads[threads[i].Id] = {false, threads[i].Name} livingThreads[temp.Id] = {false, temp.Name}
GLOBAL["__THREADS__"] = livingThreads temp.alive = false
table.remove(threads, i) temp.OnError:Fire(temp,nil,unpack(temp.returns:receive(0,"returns")))
end --GLOBAL["__THREADS__"] = livingThreads
elseif tableLen(data)>0 then table.remove(threads, i)
livingThreads[threads[i].Id] = {false, threads[i].Name} elseif status == "cancelled" then
threads[i].alive = false livingThreads[temp.Id] = {false, temp.Name}
threads[i].OnDeath:Fire(threads[i],unpack(data)) temp.alive = false
GLOBAL["__THREADS__"] = livingThreads temp.OnError:Fire(temp,nil,"thread_cancelled")
--GLOBAL["__THREADS__"] = livingThreads
table.remove(threads, i)
elseif status == "killed" then
livingThreads[temp.Id] = {false, temp.Name}
temp.alive = false
temp.OnError:Fire(temp,nil,"thread_killed")
--GLOBAL["__THREADS__"] = livingThreads
table.remove(threads, i) table.remove(threads, i)
end end
end end
end end
end).OnError(function(...) end).OnError(function(...)
print("Error!",...) print(...)
end) end)
end end
multi.print("Integrated Lanes!") multi.print("Integrated Lanes!")

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
--[[ --[[
MIT License MIT License
Copyright (c) 2020 Ryan Ward Copyright (c) 2022 Ryan Ward
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

17
test3.lua Normal file
View File

@ -0,0 +1,17 @@
lanes = require("lanes").configure({allocator="protected",verbose_errors=""})
local multi,thread = require("multi"):init()
function sleep(n)
if n > 0 then os.execute("ping -n " .. tonumber(n+1) .. " localhost > NUL") end
end
lanes.gen("*",function()
print("Hello!")
end)()
multi:newThread("Test thread",function()
while true do
thread.sleep(1)
print("...")
end
end)
multi:mainloop()