File: 125-thread.current-not-cleared-on-error.lua

package info (click to toggle)
lua-cqueues 20200726-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 1,848 kB
  • sloc: ansic: 23,623; sh: 2,984; makefile: 24
file content (24 lines) | stat: -rwxr-xr-x 443 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
_=[[
	. "${0%%/*}/regress.sh"
	exec runlua "$0" "$@"
]]
require"regress".export".*"

local cq = cqueues.new()
local is_ok = false
cq:wrap(function()
    cq:wrap(function()
        is_ok = true
    end)
    error("an error", 0)
end)

-- First step should signal an error
local ok, err = cq:step()
check(not ok and err == "an error", err)

-- Second step should succeed
check(cq:step())
check(is_ok, "second thread not run")
say("OK")