Fixed rockspec for threading.lua, tweaking code
This commit is contained in:
parent
ade5172f26
commit
06132fc1dd
10
changes.md
10
changes.md
@ -1,9 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
Table of contents
|
Table of contents
|
||||||
---
|
---
|
||||||
[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.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.1.0 - Hold the ~~phone~~ thread
|
# Update 15.1.0 - Hold the thread!
|
||||||
|
|
||||||
Full Update Showcase
|
Full Update Showcase
|
||||||
|
|
||||||
@ -68,6 +68,10 @@ multi:mainloop()
|
|||||||
Added:
|
Added:
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## multi.TIMEOUT
|
||||||
|
|
||||||
|
`multi.TIMEOUT` is equal to "TIMEOUT", it is reccomended to use this incase things change later on. There are plans to change the timeout value to become a custom object instead of a string.
|
||||||
|
|
||||||
## multi:newProcessor(name)
|
## multi:newProcessor(name)
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
@ -125,6 +129,8 @@ Changed:
|
|||||||
| interval | Time between each poll |
|
| interval | Time between each poll |
|
||||||
|
|
||||||
**Note:** cycles and sleep options cannot both be used at the same time. Cycles take priority if both are present! HoldFor and HoldWithin can be emulated using the new features. Old functions will remain for backward compatibility.
|
**Note:** cycles and sleep options cannot both be used at the same time. Cycles take priority if both are present! HoldFor and HoldWithin can be emulated using the new features. Old functions will remain for backward compatibility.
|
||||||
|
|
||||||
|
Using cycles, sleep or interval will cause a timeout; returning nil, multi.TIMEOUT
|
||||||
- `n` can be a number and thread.hold will act like thread.sleep. When `n` is a number the option table will be ignored!
|
- `n` can be a number and thread.hold will act like thread.sleep. When `n` is a number the option table will be ignored!
|
||||||
|
|
||||||
Removed:
|
Removed:
|
||||||
|
|||||||
@ -46,6 +46,7 @@ multi.clock = os.clock
|
|||||||
multi.time = os.time
|
multi.time = os.time
|
||||||
multi.LinkedPath = multi
|
multi.LinkedPath = multi
|
||||||
multi.lastTime = clock()
|
multi.lastTime = clock()
|
||||||
|
multi.TIMEOUT = "TIMEOUT"
|
||||||
|
|
||||||
multi.Priority_Core = 1
|
multi.Priority_Core = 1
|
||||||
multi.Priority_Very_High = 4
|
multi.Priority_Very_High = 4
|
||||||
@ -1108,7 +1109,7 @@ function multi.holdFor(n,func)
|
|||||||
if func() then
|
if func() then
|
||||||
return func()
|
return func()
|
||||||
elseif temp then
|
elseif temp then
|
||||||
return multi.NIL, "TIMEOUT"
|
return multi.NIL, multi.TIMEOUT
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
@ -1434,7 +1435,7 @@ function multi:attachScheduler()
|
|||||||
threads[i].task = ""
|
threads[i].task = ""
|
||||||
threads[i].__ready = true
|
threads[i].__ready = true
|
||||||
t0 = nil
|
t0 = nil
|
||||||
t1 = "TIMEOUT"
|
t1 = multi.TIMEOUT
|
||||||
end
|
end
|
||||||
threads[i].intervalR = clock()
|
threads[i].intervalR = clock()
|
||||||
end
|
end
|
||||||
@ -1450,7 +1451,7 @@ function multi:attachScheduler()
|
|||||||
threads[i].task = ""
|
threads[i].task = ""
|
||||||
threads[i].__ready = true
|
threads[i].__ready = true
|
||||||
t0 = nil
|
t0 = nil
|
||||||
t1 = "TIMEOUT"
|
t1 = multi.TIMEOUT
|
||||||
end
|
end
|
||||||
threads[i].intervalR = clock()
|
threads[i].intervalR = clock()
|
||||||
end
|
end
|
||||||
|
|||||||
@ -30,7 +30,7 @@ function multi:newSystemThreadedQueue(name)
|
|||||||
local fRef = {"func",nil}
|
local fRef = {"func",nil}
|
||||||
function c:init()
|
function c:init()
|
||||||
local q = {}
|
local q = {}
|
||||||
q.chan = love.thread.getChannel(self.Name)
|
q.chan = lovr.thread.getChannel(self.Name)
|
||||||
function q:push(dat)
|
function q:push(dat)
|
||||||
if type(dat) == "function" then
|
if type(dat) == "function" then
|
||||||
fRef[2] = THREAD.dump(dat)
|
fRef[2] = THREAD.dump(dat)
|
||||||
@ -76,9 +76,9 @@ function multi:newSystemThreadedJobQueue(n)
|
|||||||
c.cores = n or THREAD.getCores()
|
c.cores = n or THREAD.getCores()
|
||||||
c.registerQueue = {}
|
c.registerQueue = {}
|
||||||
c.funcs = THREAD.createStaticTable("__JobQueue_"..jqc.."_table")
|
c.funcs = THREAD.createStaticTable("__JobQueue_"..jqc.."_table")
|
||||||
c.queue = love.thread.getChannel("__JobQueue_"..jqc.."_queue")
|
c.queue = lovr.thread.getChannel("__JobQueue_"..jqc.."_queue")
|
||||||
c.queueReturn = love.thread.getChannel("__JobQueue_"..jqc.."_queueReturn")
|
c.queueReturn = lovr.thread.getChannel("__JobQueue_"..jqc.."_queueReturn")
|
||||||
c.queueAll = love.thread.getChannel("__JobQueue_"..jqc.."_queueAll")
|
c.queueAll = lovr.thread.getChannel("__JobQueue_"..jqc.."_queueAll")
|
||||||
c.id = 0
|
c.id = 0
|
||||||
c.OnJobCompleted = multi:newConnection()
|
c.OnJobCompleted = multi:newConnection()
|
||||||
local allfunc = 0
|
local allfunc = 0
|
||||||
@ -138,16 +138,16 @@ function multi:newSystemThreadedJobQueue(n)
|
|||||||
for i=1,c.cores do
|
for i=1,c.cores do
|
||||||
multi:newSystemThread("JobQueue_"..jqc.."_worker_"..i,function(jqc)
|
multi:newSystemThread("JobQueue_"..jqc.."_worker_"..i,function(jqc)
|
||||||
local multi, thread = require("multi"):init()
|
local multi, thread = require("multi"):init()
|
||||||
require("love.timer")
|
require("lovr.timer")
|
||||||
local function atomic(channel)
|
local function atomic(channel)
|
||||||
return channel:pop()
|
return channel:pop()
|
||||||
end
|
end
|
||||||
local clock = os.clock
|
local clock = os.clock
|
||||||
local funcs = THREAD.createStaticTable("__JobQueue_"..jqc.."_table")
|
local funcs = THREAD.createStaticTable("__JobQueue_"..jqc.."_table")
|
||||||
local queue = love.thread.getChannel("__JobQueue_"..jqc.."_queue")
|
local queue = lovr.thread.getChannel("__JobQueue_"..jqc.."_queue")
|
||||||
local queueReturn = love.thread.getChannel("__JobQueue_"..jqc.."_queueReturn")
|
local queueReturn = lovr.thread.getChannel("__JobQueue_"..jqc.."_queueReturn")
|
||||||
local lastProc = clock()
|
local lastProc = clock()
|
||||||
local queueAll = love.thread.getChannel("__JobQueue_"..jqc.."_queueAll")
|
local queueAll = lovr.thread.getChannel("__JobQueue_"..jqc.."_queueAll")
|
||||||
local registry = {}
|
local registry = {}
|
||||||
setmetatable(_G,{__index = funcs})
|
setmetatable(_G,{__index = funcs})
|
||||||
multi:newThread("startUp",function()
|
multi:newThread("startUp",function()
|
||||||
|
|||||||
@ -23,11 +23,11 @@ SOFTWARE.
|
|||||||
]]
|
]]
|
||||||
-- TODO make compatible with lovr
|
-- TODO make compatible with lovr
|
||||||
if ISTHREAD then
|
if ISTHREAD then
|
||||||
error("You cannot require the loveManager from within a thread!")
|
error("You cannot require the lovrManager from within a thread!")
|
||||||
end
|
end
|
||||||
local ThreadFileData = [[
|
local ThreadFileData = [[
|
||||||
ISTHREAD = true
|
ISTHREAD = true
|
||||||
THREAD = require("multi.integration.loveManager.threads") -- order is important!
|
THREAD = require("multi.integration.lovrManager.threads") -- order is important!
|
||||||
sThread = THREAD
|
sThread = THREAD
|
||||||
__IMPORTS = {...}
|
__IMPORTS = {...}
|
||||||
__FUNC__=table.remove(__IMPORTS,1)
|
__FUNC__=table.remove(__IMPORTS,1)
|
||||||
@ -38,13 +38,13 @@ GLOBAL = THREAD.getGlobal()
|
|||||||
multi, thread = require("multi").init()
|
multi, thread = require("multi").init()
|
||||||
stab["returns"] = {THREAD.loadDump(__FUNC__)(unpack(__IMPORTS))}
|
stab["returns"] = {THREAD.loadDump(__FUNC__)(unpack(__IMPORTS))}
|
||||||
]]
|
]]
|
||||||
local multi, thread = require("multi.compat.love2d"):init()
|
local multi, thread = require("multi.compat.lovr2d"):init()
|
||||||
local THREAD = {}
|
local THREAD = {}
|
||||||
__THREADID__ = 0
|
__THREADID__ = 0
|
||||||
__THREADNAME__ = "MainThread"
|
__THREADNAME__ = "MainThread"
|
||||||
multi.integration={}
|
multi.integration={}
|
||||||
multi.integration.love2d={}
|
multi.integration.lovr2d={}
|
||||||
local THREAD = require("multi.integration.loveManager.threads")
|
local THREAD = require("multi.integration.lovrManager.threads")
|
||||||
local GLOBAL = THREAD.getGlobal()
|
local GLOBAL = THREAD.getGlobal()
|
||||||
local THREAD_ID = 1
|
local THREAD_ID = 1
|
||||||
local OBJECT_ID = 0
|
local OBJECT_ID = 0
|
||||||
@ -68,7 +68,7 @@ function multi:newSystemThread(name,func,...)
|
|||||||
local c = {}
|
local c = {}
|
||||||
c.name = name
|
c.name = name
|
||||||
c.ID=THREAD_ID
|
c.ID=THREAD_ID
|
||||||
c.thread=love.thread.newThread(ThreadFileData)
|
c.thread=lovr.thread.newThread(ThreadFileData)
|
||||||
c.thread:start(THREAD.dump(func),c.ID,c.name,...)
|
c.thread:start(THREAD.dump(func),c.ID,c.name,...)
|
||||||
c.stab = THREAD.createStaticTable(name)
|
c.stab = THREAD.createStaticTable(name)
|
||||||
GLOBAL["__THREAD_"..c.ID] = {ID=c.ID,Name=c.name,Thread=c.thread}
|
GLOBAL["__THREAD_"..c.ID] = {ID=c.ID,Name=c.name,Thread=c.thread}
|
||||||
@ -76,13 +76,13 @@ function multi:newSystemThread(name,func,...)
|
|||||||
THREAD_ID=THREAD_ID+1
|
THREAD_ID=THREAD_ID+1
|
||||||
return c
|
return c
|
||||||
end
|
end
|
||||||
function love.threaderror(thread, errorstr)
|
function lovr.threaderror(thread, errorstr)
|
||||||
print("Thread error!\n"..errorstr)
|
print("Thread error!\n"..errorstr)
|
||||||
end
|
end
|
||||||
multi.integration.GLOBAL = GLOBAL
|
multi.integration.GLOBAL = GLOBAL
|
||||||
multi.integration.THREAD = THREAD
|
multi.integration.THREAD = THREAD
|
||||||
require("multi.integration.loveManager.extensions")
|
require("multi.integration.lovrManager.extensions")
|
||||||
print("Integrated Love Threading!")
|
print("Integrated lovr Threading!")
|
||||||
return {init=function()
|
return {init=function()
|
||||||
return GLOBAL,THREAD
|
return GLOBAL,THREAD
|
||||||
end}
|
end}
|
||||||
@ -22,9 +22,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
]]
|
]]
|
||||||
-- TODO make compatible with lovr
|
-- TODO make compatible with lovr
|
||||||
require("love.timer")
|
require("lovr.timer")
|
||||||
require("love.system")
|
require("lovr.system")
|
||||||
require("love.data")
|
require("lovr.data")
|
||||||
local socket = require("socket")
|
local socket = require("socket")
|
||||||
local multi, thread = require("multi").init()
|
local multi, thread = require("multi").init()
|
||||||
local threads = {}
|
local threads = {}
|
||||||
@ -32,7 +32,7 @@ function threads.loadDump(d)
|
|||||||
return loadstring(d:getString())
|
return loadstring(d:getString())
|
||||||
end
|
end
|
||||||
function threads.dump(func)
|
function threads.dump(func)
|
||||||
return love.data.newByteData(string.dump(func))
|
return lovr.data.newByteData(string.dump(func))
|
||||||
end
|
end
|
||||||
local fRef = {"func",nil}
|
local fRef = {"func",nil}
|
||||||
local function manage(channel, value)
|
local function manage(channel, value)
|
||||||
@ -56,11 +56,11 @@ end
|
|||||||
local GNAME = "__GLOBAL_"
|
local GNAME = "__GLOBAL_"
|
||||||
local proxy = {}
|
local proxy = {}
|
||||||
function threads.set(name,val)
|
function threads.set(name,val)
|
||||||
if not proxy[name] then proxy[name] = love.thread.getChannel(GNAME..name) end
|
if not proxy[name] then proxy[name] = lovr.thread.getChannel(GNAME..name) end
|
||||||
proxy[name]:performAtomic(manage, val)
|
proxy[name]:performAtomic(manage, val)
|
||||||
end
|
end
|
||||||
function threads.get(name)
|
function threads.get(name)
|
||||||
if not proxy[name] then proxy[name] = love.thread.getChannel(GNAME..name) end
|
if not proxy[name] then proxy[name] = lovr.thread.getChannel(GNAME..name) end
|
||||||
local dat = proxy[name]:peek()
|
local dat = proxy[name]:peek()
|
||||||
if type(dat)=="table" and dat[1]=="func" then
|
if type(dat)=="table" and dat[1]=="func" then
|
||||||
return THREAD.loadDump(dat[2])
|
return THREAD.loadDump(dat[2])
|
||||||
@ -75,7 +75,7 @@ function threads.waitFor(name)
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
while threads.get(name)==nil do
|
while threads.get(name)==nil do
|
||||||
love.timer.sleep(.001)
|
lovr.timer.sleep(.001)
|
||||||
end
|
end
|
||||||
local dat = threads.get(name)
|
local dat = threads.get(name)
|
||||||
if type(dat) == "table" and dat.init then
|
if type(dat) == "table" and dat.init then
|
||||||
@ -90,7 +90,7 @@ function threads.package(name,val)
|
|||||||
val.init=init
|
val.init=init
|
||||||
end
|
end
|
||||||
function threads.getCores()
|
function threads.getCores()
|
||||||
return love.system.getProcessorCount()
|
return lovr.system.getProcessorCount()
|
||||||
end
|
end
|
||||||
function threads.kill()
|
function threads.kill()
|
||||||
error("Thread Killed!")
|
error("Thread Killed!")
|
||||||
@ -112,7 +112,7 @@ function threads.getID()
|
|||||||
return __THREADID__
|
return __THREADID__
|
||||||
end
|
end
|
||||||
function threads.sleep(n)
|
function threads.sleep(n)
|
||||||
love.timer.sleep(n)
|
lovr.timer.sleep(n)
|
||||||
end
|
end
|
||||||
function threads.getGlobal()
|
function threads.getGlobal()
|
||||||
return setmetatable({},
|
return setmetatable({},
|
||||||
@ -129,11 +129,11 @@ end
|
|||||||
function threads.createTable(n)
|
function threads.createTable(n)
|
||||||
local _proxy = {}
|
local _proxy = {}
|
||||||
local function set(name,val)
|
local function set(name,val)
|
||||||
if not _proxy[name] then _proxy[name] = love.thread.getChannel(n..name) end
|
if not _proxy[name] then _proxy[name] = lovr.thread.getChannel(n..name) end
|
||||||
_proxy[name]:performAtomic(manage, val)
|
_proxy[name]:performAtomic(manage, val)
|
||||||
end
|
end
|
||||||
local function get(name)
|
local function get(name)
|
||||||
if not _proxy[name] then _proxy[name] = love.thread.getChannel(n..name) end
|
if not _proxy[name] then _proxy[name] = lovr.thread.getChannel(n..name) end
|
||||||
local dat = _proxy[name]:peek()
|
local dat = _proxy[name]:peek()
|
||||||
if type(dat)=="table" and dat[1]=="func" then
|
if type(dat)=="table" and dat[1]=="func" then
|
||||||
return THREAD.loadDump(dat[2])
|
return THREAD.loadDump(dat[2])
|
||||||
@ -154,7 +154,7 @@ function threads.createTable(n)
|
|||||||
end
|
end
|
||||||
function threads.getConsole()
|
function threads.getConsole()
|
||||||
local c = {}
|
local c = {}
|
||||||
c.queue = love.thread.getChannel("__CONSOLE__")
|
c.queue = lovr.thread.getChannel("__CONSOLE__")
|
||||||
function c.print(...)
|
function c.print(...)
|
||||||
c.queue:push{...}
|
c.queue:push{...}
|
||||||
end
|
end
|
||||||
@ -167,7 +167,7 @@ end
|
|||||||
if not ISTHREAD then
|
if not ISTHREAD then
|
||||||
local clock = os.clock
|
local clock = os.clock
|
||||||
local lastproc = clock()
|
local lastproc = clock()
|
||||||
local queue = love.thread.getChannel("__CONSOLE__")
|
local queue = lovr.thread.getChannel("__CONSOLE__")
|
||||||
multi:newThread("consoleManager",function()
|
multi:newThread("consoleManager",function()
|
||||||
while true do
|
while true do
|
||||||
thread.yield()
|
thread.yield()
|
||||||
@ -186,14 +186,14 @@ function threads.createStaticTable(n)
|
|||||||
local __proxy = {}
|
local __proxy = {}
|
||||||
local function set(name,val)
|
local function set(name,val)
|
||||||
if __proxy[name] then return end
|
if __proxy[name] then return end
|
||||||
local chan = love.thread.getChannel(n..name)
|
local chan = lovr.thread.getChannel(n..name)
|
||||||
if chan:getCount()>0 then return end
|
if chan:getCount()>0 then return end
|
||||||
chan:performAtomic(manage, val)
|
chan:performAtomic(manage, val)
|
||||||
__proxy[name] = val
|
__proxy[name] = val
|
||||||
end
|
end
|
||||||
local function get(name)
|
local function get(name)
|
||||||
if __proxy[name] then return __proxy[name] end
|
if __proxy[name] then return __proxy[name] end
|
||||||
local dat = love.thread.getChannel(n..name):peek()
|
local dat = lovr.thread.getChannel(n..name):peek()
|
||||||
if type(dat)=="table" and dat[1]=="func" then
|
if type(dat)=="table" and dat[1]=="func" then
|
||||||
__proxy[name] = THREAD.loadDump(dat[2])
|
__proxy[name] = THREAD.loadDump(dat[2])
|
||||||
return __proxy[name]
|
return __proxy[name]
|
||||||
|
|||||||
@ -22,7 +22,7 @@ build = {
|
|||||||
modules = {
|
modules = {
|
||||||
["multi"] = "multi/init.lua",
|
["multi"] = "multi/init.lua",
|
||||||
["multi.compat.love2d"] = "multi/compat/love2d.lua",
|
["multi.compat.love2d"] = "multi/compat/love2d.lua",
|
||||||
["multi.integration"] = "multi/integration/threading.lua",
|
["multi.integration.threading"] = "multi/integration/threading.lua",
|
||||||
["multi.integration.lanesManager"] = "multi/integration/lanesManager/init.lua",
|
["multi.integration.lanesManager"] = "multi/integration/lanesManager/init.lua",
|
||||||
["multi.integration.lanesManager.extensions"] = "multi/integration/lanesManager/extensions.lua",
|
["multi.integration.lanesManager.extensions"] = "multi/integration/lanesManager/extensions.lua",
|
||||||
["multi.integration.lanesManager.threads"] = "multi/integration/lanesManager/threads.lua",
|
["multi.integration.lanesManager.threads"] = "multi/integration/lanesManager/threads.lua",
|
||||||
|
|||||||
@ -2,13 +2,13 @@ package = "multi"
|
|||||||
version = "15.1-0"
|
version = "15.1-0"
|
||||||
source = {
|
source = {
|
||||||
url = "git://github.com/rayaman/multi.git",
|
url = "git://github.com/rayaman/multi.git",
|
||||||
tag = "v15.1.0",
|
tag = "V15.1.0",
|
||||||
}
|
}
|
||||||
description = {
|
description = {
|
||||||
summary = "Lua Multi tasking library",
|
summary = "Lua Multi tasking library",
|
||||||
detailed = [[
|
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).
|
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 how to use.
|
Check github for documentation.
|
||||||
]],
|
]],
|
||||||
homepage = "https://github.com/rayaman/multi",
|
homepage = "https://github.com/rayaman/multi",
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
@ -23,7 +23,6 @@ build = {
|
|||||||
["multi"] = "multi/init.lua",
|
["multi"] = "multi/init.lua",
|
||||||
["multi.compat.love2d"] = "multi/compat/love2d.lua",
|
["multi.compat.love2d"] = "multi/compat/love2d.lua",
|
||||||
["multi.compat.lovr"] = "multi/compat/lovr.lua",
|
["multi.compat.lovr"] = "multi/compat/lovr.lua",
|
||||||
["multi.integration"] = "multi/integration/threading.lua",
|
|
||||||
["multi.integration.lanesManager"] = "multi/integration/lanesManager/init.lua",
|
["multi.integration.lanesManager"] = "multi/integration/lanesManager/init.lua",
|
||||||
["multi.integration.lanesManager.extensions"] = "multi/integration/lanesManager/extensions.lua",
|
["multi.integration.lanesManager.extensions"] = "multi/integration/lanesManager/extensions.lua",
|
||||||
["multi.integration.lanesManager.threads"] = "multi/integration/lanesManager/threads.lua",
|
["multi.integration.lanesManager.threads"] = "multi/integration/lanesManager/threads.lua",
|
||||||
@ -37,6 +36,7 @@ build = {
|
|||||||
["multi.integration.pesudoManager.extensions"] = "multi/integration/pesudoManager/extensions.lua",
|
["multi.integration.pesudoManager.extensions"] = "multi/integration/pesudoManager/extensions.lua",
|
||||||
["multi.integration.pesudoManager.threads"] = "multi/integration/pesudoManager/threads.lua",
|
["multi.integration.pesudoManager.threads"] = "multi/integration/pesudoManager/threads.lua",
|
||||||
["multi.integration.luvitManager"] = "multi/integration/luvitManager.lua",
|
["multi.integration.luvitManager"] = "multi/integration/luvitManager.lua",
|
||||||
|
["multi.integration.threading"] = "multi/integration/threading.lua",
|
||||||
--["multi.integration.networkManager"] = "multi/integration/networkManager.lua",
|
--["multi.integration.networkManager"] = "multi/integration/networkManager.lua",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user