Skip to content

Commit

Permalink
Changing the behavior of the SLEEP command to avoid a race condition
Browse files Browse the repository at this point in the history
This command is only used in integration tests, so this is safe
  • Loading branch information
npwoods committed Jul 10, 2023
1 parent 2b13d28 commit 826a92c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions plugins/worker_ui/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -625,13 +625,12 @@ function command_ping(args)
next_ping_should_be_light = true
end

-- SLEEP command
-- SLEEP command (in practice only used by tests)
local wake_up_time = nil
function command_sleep(args)
-- don't pause and sleep at the same time
-- if we're sleeping, unpause
if machine().paused then
print("@ERROR ### Cannot sleep while paused")
return
emu.unpause()
end

wake_up_time = emu.time() + tonumber(args[2])
Expand Down

0 comments on commit 826a92c

Please sign in to comment.