1
0
mirror of https://github.com/kepler155c/opus synced 2025-12-17 05:38:07 +00:00

Forms - dialogs

This commit is contained in:
kepler155c@gmail.com
2016-12-26 22:26:43 -05:00
parent d61260ec9b
commit 5c12b20fae
14 changed files with 365 additions and 292 deletions

View File

@@ -1,4 +1,5 @@
local Util = require('util')
local Process = require('process')
local Event = {
uid = 1, -- unique id for handlers
@@ -123,8 +124,9 @@ local function _pullEvents()
--exitPullEvents = false
while true do
local e = Event.pullEvent()
if exitPullEvents or e == 'terminate' then
local e = { Process:pullEvent() }
Event.processEvent(e)
if exitPullEvents or e[1] == 'terminate' then
break
end
end
@@ -137,13 +139,18 @@ function Event.sleep(t)
until event == 'timer' and id == timerId
end
function Event.addThread(fn)
return Process:addThread(fn)
end
function Event.pullEvents(...)
local routines = { ... }
if #routines > 0 then
parallel.waitForAny(_pullEvents, ...)
else
_pullEvents()
for _, routine in ipairs(routines) do
Process:addThread(routine)
end
end
_pullEvents()
end
function Event.exitPullEvents()