fixing stuff

This commit is contained in:
Ryan Ward 2023-07-04 13:32:38 -04:00
parent 96cc41effb
commit 03a2f686a8

View File

@ -132,7 +132,6 @@ multi:newThread("Scheduler Thread",function()
multi.success("SystemThreadedJobQueues: Ok") multi.success("SystemThreadedJobQueues: Ok")
queue2 = multi:newSystemThreadedQueue("Test_Queue2"):init() queue2 = multi:newSystemThreadedQueue("Test_Queue2"):init()
print(1)
multi:newSystemThread("Test_Thread_2",function() multi:newSystemThread("Test_Thread_2",function()
queue2 = THREAD.waitFor("Test_Queue2"):init() queue2 = THREAD.waitFor("Test_Queue2"):init()
connOut = THREAD.waitFor("ConnectionNAMEHERE"):init() connOut = THREAD.waitFor("ConnectionNAMEHERE"):init()
@ -141,7 +140,6 @@ multi:newThread("Scheduler Thread",function()
end) end)
multi:mainloop() multi:mainloop()
end).OnError(multi.error) end).OnError(multi.error)
print(2)
multi:newSystemThread("Test_Thread_3",function() multi:newSystemThread("Test_Thread_3",function()
queue2 = THREAD.waitFor("Test_Queue2"):init() queue2 = THREAD.waitFor("Test_Queue2"):init()
connOut = THREAD.waitFor("ConnectionNAMEHERE"):init() connOut = THREAD.waitFor("ConnectionNAMEHERE"):init()
@ -150,35 +148,28 @@ multi:newThread("Scheduler Thread",function()
end) end)
multi:mainloop() multi:mainloop()
end).OnError(multi.error) end).OnError(multi.error)
print(3)
connOut = multi:newSystemThreadedConnection("ConnectionNAMEHERE"):init() connOut = multi:newSystemThreadedConnection("ConnectionNAMEHERE"):init()
a=0 a=0
connOut(function(arg) connOut(function(arg)
queue2:push("Main") queue2:push("Main")
end) end)
print(4)
for i=1,3 do for i=1,3 do
thread.sleep(.1) thread.sleep(.1)
connOut:Fire("Test From Main Thread: "..i.."\n") connOut:Fire("Test From Main Thread: "..i.."\n")
end end
print(5)
thread.sleep(2) thread.sleep(2)
local count = 0 local count = 0
multi:newThread(function() multi:newThread(function()
while count < 9 do while count < 9 do
if queue2:pop() then if queue2:pop() then
count = count + 1 count = count + 1
print("Popped", count)
end end
end end
end).OnError(multi.error) end).OnError(multi.error)
print(6)
_, err = thread.hold(function() return count == 9 end,{sleep=.3}) _, err = thread.hold(function() return count == 9 end,{sleep=.3})
print(7)
if err == multi.TIMEOUT then if err == multi.TIMEOUT then
multi.error("SystemThreadedConnections: Failed") multi.error("SystemThreadedConnections: Failed")
end end
print(8)
multi.success("SystemThreadedConnections: Ok") multi.success("SystemThreadedConnections: Ok")
we_good = true we_good = true
@ -188,6 +179,7 @@ end).OnError(multi.error)
multi.OnExit(function(err) multi.OnExit(function(err)
if not we_good then if not we_good then
multi.error("There was an error running some tests!") multi.error("There was an error running some tests!")
os.exit(1)
else else
multi.success("Tests complete!") multi.success("Tests complete!")
end end