forked from Hyperion/HyperionOS
finished vfs for a while
This commit is contained in:
@@ -1,42 +1,41 @@
|
||||
--:Minify:--
|
||||
local kernel=...
|
||||
-- :Minify:--
|
||||
local kernel = ...
|
||||
local io = {}
|
||||
kernel.io=io
|
||||
io.eventq={}
|
||||
kernel.io = io
|
||||
io.eventq = {}
|
||||
|
||||
function io.pushEvent(queue, ...)
|
||||
queue=tostring(queue)
|
||||
if not io.eventq[queue] then
|
||||
io.eventq[queue]={}
|
||||
end
|
||||
io.eventq[queue][#io.eventq[queue]+1]={...}
|
||||
queue = tostring(queue)
|
||||
if not io.eventq[queue] then io.eventq[queue] = {} end
|
||||
io.eventq[queue][#io.eventq[queue] + 1] = {...}
|
||||
end
|
||||
|
||||
function io.bind(queue)
|
||||
queue=tostring(queue)
|
||||
kernel.currentTask.eventq=queue
|
||||
queue = tostring(queue)
|
||||
kernel.currentTask.eventq = queue
|
||||
end
|
||||
|
||||
function io.pullEvent()
|
||||
if io.eventq[kernel.currentTask.eventq] then
|
||||
if #io.eventq[kernel.currentTask.eventq]==1 then
|
||||
if #io.eventq[kernel.currentTask.eventq] == 1 then
|
||||
local event = table.remove(io.eventq[kernel.currentTask.eventq] or {}, 1)
|
||||
io.eventq[kernel.currentTask.eventq]=nil
|
||||
io.eventq[kernel.currentTask.eventq] = nil
|
||||
return table.unpack(event)
|
||||
end
|
||||
local event = table.remove(io.eventq[kernel.currentTask.eventq] or {}, 1)
|
||||
|
||||
local event =
|
||||
table.remove(io.eventq[kernel.currentTask.eventq] or {}, 1)
|
||||
|
||||
if not event then return end
|
||||
return table.unpack(event)
|
||||
end
|
||||
end
|
||||
|
||||
function io.getBoundQueue()
|
||||
return kernel.currentTask.eventq
|
||||
end
|
||||
function io.getBoundQueue() return kernel.currentTask.eventq end
|
||||
|
||||
kernel.syscalls["IO_pushEvent"]=io.pushEvent
|
||||
kernel.syscalls["IO_pullEvent"]=io.pullEvent
|
||||
kernel.syscalls["IO_bind"]=io.bind
|
||||
kernel.syscalls["IO_getBoundQueue"]=io.getBoundQueue
|
||||
kernel.syscalls["IO_pushEvent"] = io.pushEvent
|
||||
kernel.syscalls["IO_pullEvent"] = io.pullEvent
|
||||
kernel.syscalls["IO_bind"] = io.bind
|
||||
kernel.syscalls["IO_getBoundQueue"] = io.getBoundQueue
|
||||
|
||||
kernel.log("IO pipeline initialized")
|
||||
kernel.log("IO pipeline initialized")
|
||||
|
||||
Reference in New Issue
Block a user