* Fixed spelling, started ideaing for 16.0.0 * Updated files * Updated readme * Updated version * Concat conns now properly transfer events * Testing types * Connections can be % with functions * Updated connections * Fixed issue with double thread activations (Looking for another solution) * Working on issue with love threaded functions not waiting when in a thread * Working on issue where threads created in threads don't work * Fixed broken threads for love * Fixed some issues with threads * removed test * Updated changes.md * Plan on testing parity between the threading modules * Writing tests for system threading * Added test cases for threading, fixed issues. Todo test love2d * Fixed love2d to succeed with tests * All tests working * Updated files for testing * Modified tests to make it more seamless * removed extra __cores in lanes/pseudo * Working on new priority scheme * Working on priority management * Working on custom prioritySchemes * Fixed issues with missing code * Threaded processors * THREAD.exposeENV(), thread:newProcessor() * Typo in changes.md * Fixed typo in pseudoManager * fixing * Trying to fix exposeENV with pseudoThreading * Changes to threads * updated changes.md * Working on systemthreadedprocess, and experimental newProxy for threading * newProxy and STP work * newProxy implemented * Proxies work with connections now :D * Added tstep to STP, updated changes.md * thread.hold(proxy.conn) * Clean up connection events when holding, working on scheduling tasks/threads to system threaded processors * Getting loads of processors implemented * Finished getLoad(type) * Fixed some bugs * Added an easy way to share a table, found some limitations with lanes threading. * THREAD_NAME set for main thread, connections break the rules for proxies * Testing * Really close to portable proxies, currently extreamly unstable! * Debugging what is going on... * Fixed critical issue with coroutine based threads * Removed extra bloat, proxies are portable now! * Started work on the debugManager * Testing actions, fixing bugs with lanes * Testing... * fixing actions * typo fixed * Throw an error when things break * fixing stuff * Fixed issue with errors not going through * Removed system threaded connections, soon to be replaced by proxies * Testing love2d tests * Test love2d * Use later love-build * Use ubuntu for build * Fixed path * Use appimage * use sudo * No window for love2d * Fixed love2d tests * Testing love2d * Use workspace * Moved other tests while testing * actually pull the repo * packagepath set * Fixed pull * Update multi * Removed link * Edited symlink * Added timeout to build * Rewriting loveManager, too much outdated code * Still implementing new love2d threading code * Rewriting love2d threading binding * Working on adding a Hold method to all objects. Will document how they all work when done. * jobqueues having isues with stp * new pack/unpack for tables, current issue is things being turned into strings * Fixed packing of values into threads, need to fix system proxies and system threaded processors * testing... * Not hard crashing when error is encountered * Should now push non 0 exit codes * Push error when an error happens * Closer to getting things working... * Working on new type system, planning out debugmanager * Fixed error code issue * Test for 5.1 * Planning out debugManager * Some work on the debug manager, proxies working on lanes, todo get pseudo manager and love2d working * Working on getting pseudoThreading tests to work * Added function / connection * Added boost method * Document new features to conns, todo fix newTask * Fixed newTask() * Updated changes.md and fixed some bugs * Added thread.defer(func) * Fixed tests on lanes and pseudo threading, todo fix love2d threading * Fixed paths * Working on paths * Testing paths * Add test for rockspec * Fixed issues * Fixed typo * Added test for defer * Threading working in love2d * Fixed, conf * lanes uses a threaded function like waitfor function * Cleaned up changes.md * added priorityManager to rockspec
107 lines
2.6 KiB
Lua
107 lines
2.6 KiB
Lua
local multi, thread = require("multi"):init()
|
|
|
|
multi.defaultSettings.debugging = true
|
|
|
|
local dbg = {}
|
|
dbg.__index = dbg
|
|
dbg.processors = {}
|
|
|
|
-- Hooks to all on object created events!
|
|
local c_cache = {}
|
|
local d_cache = {}
|
|
|
|
local proc = multi:newProcessor("Debug_Processor").Start()
|
|
|
|
dbg.OnObjectCreated = function(obj, process)
|
|
if c_cache[obj] then
|
|
return false
|
|
else
|
|
c_cache[obj] = true
|
|
proc:newTask(function()
|
|
c_cache[obj] = false
|
|
end)
|
|
return true
|
|
end
|
|
end .. multi:newConnection()
|
|
|
|
dbg.OnObjectDestroyed = function(obj, process)
|
|
if d_cache[obj] then
|
|
return false
|
|
else
|
|
d_cache[obj] = true
|
|
proc:newTask(function()
|
|
d_cache[obj] = false
|
|
end)
|
|
return true
|
|
end
|
|
end .. multi:newConnection()
|
|
|
|
local creation_hook, destruction_hook
|
|
local types
|
|
local objects = {}
|
|
|
|
creation_hook = function(obj, process)
|
|
types = multi:getTypes()
|
|
if obj.Type == multi.PROCESS and not dbg.processors[obj] then
|
|
obj.OnObjectCreated(creation_hook)
|
|
obj.OnObjectDestroyed(destruction_hook)
|
|
end
|
|
|
|
table.insert(objects, obj)
|
|
|
|
dbg.OnObjectCreated:Fire(obj, process)
|
|
end
|
|
|
|
destruction_hook = function(obj, process)
|
|
for i = 1, #objects do
|
|
if objects[i] == obj then
|
|
table.remove(objects, i)
|
|
break
|
|
end
|
|
end
|
|
dbg.OnObjectDestroyed:Fire(obj, process)
|
|
end
|
|
|
|
function dbg:getObjects(typ)
|
|
if type(typ) == "string" then
|
|
local objs = {}
|
|
for i = 1, #objects do
|
|
if objects[i].Type == typ then
|
|
objs[#objs+1] = objects[i]
|
|
end
|
|
end
|
|
return objs
|
|
elseif type(typ) == "table" then -- Process
|
|
local objs = {}
|
|
for i = 1, #objects do
|
|
if objects[i].Parent == typ then
|
|
objs[#objs+1] = objects[i]
|
|
end
|
|
end
|
|
return objs
|
|
elseif type(typ) == "function" then
|
|
local objs = {}
|
|
-- Keep objects local/private, return true to add to list, false to reject, "break" to break loop
|
|
for i = 1, #objects do
|
|
local ret = typ(objects[i])
|
|
if ret then
|
|
objs[#objs+1] = objects[i]
|
|
elseif ret == "break" then
|
|
break
|
|
end
|
|
end
|
|
return objs
|
|
end
|
|
end
|
|
|
|
local debug_stats = {}
|
|
|
|
local tmulti = multi:getThreadManagerProcess()
|
|
multi.OnObjectCreated(creation_hook)
|
|
tmulti.OnObjectCreated(creation_hook)
|
|
multi.OnObjectDestroyed(destroction_hook)
|
|
tmulti.OnObjectDestroyed(destroction_hook)
|
|
|
|
-- We write to a debug interface in the multi namespace
|
|
multi.debugging = dbg
|