Back and making progress
This commit is contained in:
parent
7b70838567
commit
9050e65d93
@ -1,4 +1,4 @@
|
|||||||
# Multi Version: 15.3.0
|
# Multi Version: 15.3.0 Connecting the dots
|
||||||
**Key Changes**
|
**Key Changes**
|
||||||
-
|
-
|
||||||
|
|
||||||
@ -16,8 +16,9 @@ Progress is being made in [v15.3.0](https://github.com/rayaman/multi/tree/v15.3.
|
|||||||
INSTALLING
|
INSTALLING
|
||||||
----------
|
----------
|
||||||
Link to optional dependencies:
|
Link to optional dependencies:
|
||||||
[lanes](https://github.com/LuaLanes/lanes)
|
- [lanes](https://github.com/LuaLanes/lanes)
|
||||||
[love2d](https://love2d.org/)
|
|
||||||
|
- [love2d](https://love2d.org/)
|
||||||
|
|
||||||
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!
|
||||||
|
|||||||
31
changes.md
31
changes.md
@ -3,6 +3,37 @@ Table of contents
|
|||||||
---
|
---
|
||||||
[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-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.3.0 - A world of connection
|
||||||
|
|
||||||
|
Full Update Showcase
|
||||||
|
|
||||||
|
Added
|
||||||
|
---
|
||||||
|
- `multi:newSystemThreadedConnection()`
|
||||||
|
|
||||||
|
Allows one to trigger connection events across threads.
|
||||||
|
- `multi:newConnection():SetHelper(func)`
|
||||||
|
|
||||||
|
Sets the helper function that the connection object uses when creating connection links.
|
||||||
|
|
||||||
|
Changed
|
||||||
|
---
|
||||||
|
- `Connection:[connect, hasConnections, getConnection]` changed to be `Connection:[Connect, HasConnections, getConnections]`. This was done in an attempt to follow a consistent naming scheme. The old methods still will work to prevent old code breaking.
|
||||||
|
|
||||||
|
Removed
|
||||||
|
---
|
||||||
|
- Connection objects methods removed:
|
||||||
|
- holdUT(), HoldUT() -- With the way `thread.hold(conn)` interacts with connections this method was no longer needed. To emulate this use `multi.hold(conn)`. `multi.hold()` is able to emulate what `thread.hold()` outside of a thread, albeit with some drawbacks.
|
||||||
|
|
||||||
|
Fixed
|
||||||
|
---
|
||||||
|
-
|
||||||
|
|
||||||
|
ToDo
|
||||||
|
---
|
||||||
|
|
||||||
|
- Work on network parallelism (I am really excited to start working on this. Not because it will have much use, but because it seems like a cool addition/project to work on. I just need time to actually do work on stuff)
|
||||||
|
|
||||||
# Update 15.2.0 - Upgrade Complete
|
# Update 15.2.0 - Upgrade Complete
|
||||||
|
|
||||||
Full Update Showcase
|
Full Update Showcase
|
||||||
|
|||||||
@ -58,15 +58,15 @@ multi.Priority_Very_Low = 16384
|
|||||||
multi.Priority_Idle = 65536
|
multi.Priority_Idle = 65536
|
||||||
|
|
||||||
multi.PriorityResolve = {
|
multi.PriorityResolve = {
|
||||||
[1]="Core",
|
[1] = "Core",
|
||||||
[4]="Very High",
|
[4] = "Very High",
|
||||||
[16]="High",
|
[16] = "High",
|
||||||
[64]="Above Normal",
|
[64] = "Above Normal",
|
||||||
[256]="Normal",
|
[256] = "Normal",
|
||||||
[1024]="Below Normal",
|
[1024] = "Below Normal",
|
||||||
[4096]="Low",
|
[4096] = "Low",
|
||||||
[16384]="Very Low",
|
[16384] = "Very Low",
|
||||||
[65536]="Idle",
|
[65536] = "Idle",
|
||||||
}
|
}
|
||||||
|
|
||||||
local PList = {multi.Priority_Core,multi.Priority_Very_High,multi.Priority_High,multi.Priority_Above_Normal,multi.Priority_Normal,multi.Priority_Below_Normal,multi.Priority_Low,multi.Priority_Very_Low,multi.Priority_Idle}
|
local PList = {multi.Priority_Core,multi.Priority_Very_High,multi.Priority_High,multi.Priority_Above_Normal,multi.Priority_Normal,multi.Priority_Below_Normal,multi.Priority_Low,multi.Priority_Very_Low,multi.Priority_Idle}
|
||||||
@ -116,19 +116,20 @@ function multi:newConnection(protect,func,kill)
|
|||||||
local lock = false
|
local lock = false
|
||||||
c.callback = func
|
c.callback = func
|
||||||
c.Parent=self
|
c.Parent=self
|
||||||
|
|
||||||
setmetatable(c,{__call=function(self,...)
|
setmetatable(c,{__call=function(self,...)
|
||||||
local t = ...
|
local t = ...
|
||||||
if type(t)=="table" then
|
if type(t)=="table" then
|
||||||
for i,v in pairs(t) do
|
for i,v in pairs(t) do
|
||||||
if v==self then
|
if v==self then
|
||||||
local ref = self:connect(select(2,...))
|
local ref = self:Connect(select(2,...))
|
||||||
ref.root_link = select(1,...)
|
ref.root_link = select(1,...)
|
||||||
return ref
|
return ref
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self:connect(...)
|
return self:Connect(...)
|
||||||
else
|
else
|
||||||
return self:connect(...)
|
return self:Connect(...)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
__add = function(c1,c2)
|
__add = function(c1,c2)
|
||||||
@ -154,32 +155,18 @@ function multi:newConnection(protect,func,kill)
|
|||||||
end)
|
end)
|
||||||
return cn
|
return cn
|
||||||
end})
|
end})
|
||||||
|
|
||||||
c.Type='connector'
|
c.Type='connector'
|
||||||
c.func={}
|
c.func={}
|
||||||
c.ID=0
|
c.ID=0
|
||||||
local protect=protect or false
|
local protect=protect or false
|
||||||
local connections={}
|
local connections={}
|
||||||
c.FC=0
|
c.FC=0
|
||||||
|
|
||||||
function c:hasConnections()
|
function c:hasConnections()
|
||||||
return #call_funcs~=0
|
return #call_funcs~=0
|
||||||
end
|
end
|
||||||
function c:holdUT(n)
|
|
||||||
local n=n or 0
|
|
||||||
self.waiting=true
|
|
||||||
local count=0
|
|
||||||
local id=self:connect(function()
|
|
||||||
count = count + 1
|
|
||||||
if n<=count then
|
|
||||||
self.waiting=false
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
repeat
|
|
||||||
self.Parent:uManager()
|
|
||||||
until self.waiting==false
|
|
||||||
id:Destroy()
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
c.HoldUT=c.holdUT
|
|
||||||
function c:getConnection(name,ignore)
|
function c:getConnection(name,ignore)
|
||||||
if ignore then
|
if ignore then
|
||||||
return connections[name] or CRef
|
return connections[name] or CRef
|
||||||
@ -187,14 +174,17 @@ function multi:newConnection(protect,func,kill)
|
|||||||
return connections[name] or self
|
return connections[name] or self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function c:Lock()
|
function c:Lock()
|
||||||
lock = true
|
lock = true
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
function c:Unlock()
|
function c:Unlock()
|
||||||
lock = false
|
lock = false
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
if protect then
|
if protect then
|
||||||
function c:Fire(...)
|
function c:Fire(...)
|
||||||
if lock then return end
|
if lock then return end
|
||||||
@ -216,48 +206,56 @@ function multi:newConnection(protect,func,kill)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local fast = {}
|
local fast = {}
|
||||||
function c:getConnections()
|
function c:getConnections()
|
||||||
return call_funcs
|
return call_funcs
|
||||||
end
|
end
|
||||||
|
|
||||||
function c:fastMode()
|
function c:fastMode()
|
||||||
function self:Fire(...)
|
function self:Fire(...)
|
||||||
for i=1,#fast do
|
for i=1,#fast do
|
||||||
fast[i](...)
|
fast[i](...)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function self:connect(func)
|
function self:Connect(func)
|
||||||
table.insert(fast,func)
|
table.insert(fast,func)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function c:Bind(t)
|
function c:Bind(t)
|
||||||
local temp = call_funcs
|
local temp = call_funcs
|
||||||
call_funcs=t
|
call_funcs=t
|
||||||
return temp
|
return temp
|
||||||
end
|
end
|
||||||
|
|
||||||
function c:Remove()
|
function c:Remove()
|
||||||
local temp = call_funcs
|
local temp = call_funcs
|
||||||
call_funcs={}
|
call_funcs={}
|
||||||
return temp
|
return temp
|
||||||
end
|
end
|
||||||
|
|
||||||
local function conn_helper(self,func,name,num)
|
local function conn_helper(self,func,name,num)
|
||||||
self.ID=self.ID+1
|
self.ID=self.ID+1
|
||||||
|
|
||||||
if num then
|
if num then
|
||||||
table.insert(call_funcs,num,func)
|
table.insert(call_funcs,num,func)
|
||||||
else
|
else
|
||||||
table.insert(call_funcs,1,func)
|
table.insert(call_funcs,1,func)
|
||||||
end
|
end
|
||||||
|
|
||||||
local temp = {
|
local temp = {
|
||||||
func=func,
|
func=func,
|
||||||
Type="connector_link",
|
Type="connector_link",
|
||||||
Parent=self,
|
Parent=self,
|
||||||
connect = function(s,...)
|
connect = function(s,...)
|
||||||
return self:connect(...)
|
return self:Connect(...)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
setmetatable(temp,{
|
setmetatable(temp,{
|
||||||
__call=function(s,...)
|
__call=function(s,...)
|
||||||
return self:connect(...)
|
return self:Connect(...)
|
||||||
end,
|
end,
|
||||||
__index = function(t,k)
|
__index = function(t,k)
|
||||||
if rawget(t,"root_link") then
|
if rawget(t,"root_link") then
|
||||||
@ -272,6 +270,7 @@ function multi:newConnection(protect,func,kill)
|
|||||||
rawset(t,k,v)
|
rawset(t,k,v)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
function temp:Fire(...)
|
function temp:Fire(...)
|
||||||
if lock then return end
|
if lock then return end
|
||||||
if protect then
|
if protect then
|
||||||
@ -283,6 +282,7 @@ function multi:newConnection(protect,func,kill)
|
|||||||
return call_funcs(...)
|
return call_funcs(...)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function temp:Destroy()
|
function temp:Destroy()
|
||||||
for i=#call_funcs,1,-1 do
|
for i=#call_funcs,1,-1 do
|
||||||
if call_funcs[i]~=nil then
|
if call_funcs[i]~=nil then
|
||||||
@ -294,6 +294,7 @@ function multi:newConnection(protect,func,kill)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if name then
|
if name then
|
||||||
connections[name]=temp
|
connections[name]=temp
|
||||||
end
|
end
|
||||||
@ -302,7 +303,8 @@ function multi:newConnection(protect,func,kill)
|
|||||||
end
|
end
|
||||||
return temp
|
return temp
|
||||||
end
|
end
|
||||||
function c:connect(...)--func,name,num
|
|
||||||
|
function c:Connect(...)--func,name,num
|
||||||
local tab = {...}
|
local tab = {...}
|
||||||
local funcs={}
|
local funcs={}
|
||||||
for i=1,#tab do
|
for i=1,#tab do
|
||||||
@ -320,8 +322,15 @@ function multi:newConnection(protect,func,kill)
|
|||||||
return conn_helper(self,tab[1],tab[2],tab[3])
|
return conn_helper(self,tab[1],tab[2],tab[3])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function c:SetHelper(func)
|
||||||
|
conn_helper = func
|
||||||
|
end
|
||||||
|
|
||||||
c.Connect=c.connect
|
c.Connect=c.connect
|
||||||
c.GetConnection=c.getConnection
|
c.GetConnection=c.getConnection
|
||||||
|
c.HasConnections = c.hasConnections
|
||||||
|
c.GetConnection = c.getConnection
|
||||||
if not(ignoreconn) then
|
if not(ignoreconn) then
|
||||||
multi:create(c)
|
multi:create(c)
|
||||||
end
|
end
|
||||||
@ -2043,14 +2052,14 @@ function multi.print(...)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
multi.GetType=multi.getType
|
multi.GetType = multi.getType
|
||||||
multi.IsPaused=multi.isPaused
|
multi.IsPaused = multi.isPaused
|
||||||
multi.IsActive=multi.isActive
|
multi.IsActive = multi.isActive
|
||||||
multi.Reallocate=multi.Reallocate
|
multi.Reallocate = multi.Reallocate
|
||||||
multi.ConnectFinal=multi.connectFinal
|
multi.ConnectFinal = multi.connectFinal
|
||||||
multi.ResetTime=multi.SetTime
|
multi.ResetTime = multi.SetTime
|
||||||
multi.IsDone=multi.isDone
|
multi.IsDone = multi.isDone
|
||||||
multi.SetName = multi.setName
|
multi.SetName = multi.setName
|
||||||
|
|
||||||
-- Special Events
|
-- Special Events
|
||||||
local _os = os.exit
|
local _os = os.exit
|
||||||
|
|||||||
@ -41,6 +41,7 @@ function multi:newSystemThreadedQueue(name)
|
|||||||
GLOBAL[name or "_"] = c
|
GLOBAL[name or "_"] = c
|
||||||
return c
|
return c
|
||||||
end
|
end
|
||||||
|
|
||||||
function multi:newSystemThreadedTable(name)
|
function multi:newSystemThreadedTable(name)
|
||||||
local c = {}
|
local c = {}
|
||||||
c.link = lanes.linda()
|
c.link = lanes.linda()
|
||||||
@ -58,6 +59,7 @@ function multi:newSystemThreadedTable(name)
|
|||||||
GLOBAL[name or "_"] = c
|
GLOBAL[name or "_"] = c
|
||||||
return c
|
return c
|
||||||
end
|
end
|
||||||
|
|
||||||
function multi:newSystemThreadedJobQueue(n)
|
function multi:newSystemThreadedJobQueue(n)
|
||||||
local c = {}
|
local c = {}
|
||||||
c.cores = n or THREAD.getCores()*2
|
c.cores = n or THREAD.getCores()*2
|
||||||
|
|||||||
26
test.lua
26
test.lua
@ -2,8 +2,30 @@ package.path = "./?/init.lua;"..package.path
|
|||||||
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.threading"):init()
|
||||||
|
|
||||||
function multi:newSystemThreadedConnection()
|
function multi:newSystemThreadedConnection(name,...)
|
||||||
--
|
local master_conn = multi:newConnection(...)
|
||||||
|
local c = {}
|
||||||
|
local name = name or multi.randomString(16)
|
||||||
|
local connections = {} -- All triggers sent from main connection. When a connection is triggered on another thread, they speak to the main then send stuff out.
|
||||||
|
setmetatable(c,master_conn) -- A different approach will be taken for the non main connection objects
|
||||||
|
c.subscribe = multi:newSystemThreadedQueue("Subscribe_"..name)
|
||||||
|
multi:newThread("STC_"..name,function()
|
||||||
|
while true do
|
||||||
|
thread.yield()
|
||||||
|
local item = c.subscribe:pop()
|
||||||
|
if item ~= nil then
|
||||||
|
connections[#connections+1] = item
|
||||||
|
thread.skip(multi.Priority_Normal) -- Usually a bunch of threads subscribe close to the same time. Process those by ensuring that they come alive around the same time
|
||||||
|
else -- I'm using these "Constant" values since they may change with other releases and this should allow these functions to adjust with them.
|
||||||
|
thread.skip(multi.Priority_Idle)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
function c:init()
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
GLOBAL[name or "_"] = c
|
||||||
|
return c
|
||||||
end
|
end
|
||||||
|
|
||||||
multi:mainloop()
|
multi:mainloop()
|
||||||
Loading…
x
Reference in New Issue
Block a user