移除所有的Channel:demand,因为love.js不支持

整理代码
This commit is contained in:
MrZ_26
2024-11-02 05:52:36 +08:00
parent f2e064e900
commit 785935d26f
5 changed files with 78 additions and 84 deletions

View File

@@ -1,5 +1,5 @@
local sendCHN=love.thread.getChannel('inputChannel')
local recvCHN=love.thread.getChannel('outputChannel')
local sendCHN=love.thread.getChannel('HTTP_inputChannel')
local recvCHN=love.thread.getChannel('HTTP_outputChannel')
local threads={}
local threadCount=0
@@ -9,11 +9,15 @@ local threadCode=[[
local http=require'socket.http'
local ltn12=require'ltn12'
local sendCHN=love.thread.getChannel('inputChannel')
local recvCHN=love.thread.getChannel('outputChannel')
local sendCHN=love.thread.getChannel('HTTP_inputChannel')
local recvCHN=love.thread.getChannel('HTTP_outputChannel')
local sleep=require'love.timer'.sleep
while true do
local arg=sendCHN:demand()
-- local arg=sendCHN:demand()
-- Warning: workaround for love.js
while sendCHN:getCount()==0 do sleep(.0626) end
local arg=sendCHN:pop()
if arg._destroy then
recvCHN:push{