summaryrefslogtreecommitdiff
path: root/tests/test-sigwait.lua
blob: 1fd2f8309b85d7e6858ce1716598ebe1336f8131 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- See LICENSE file for copyright and license details.
local l = require "luxio"

function handler()
	return
end

l.sigaction(l.SIGINT, {["sa_handler"] = handler})

s = l.newsigset()
l.sigemptyset(s)
l.sigaddset(s, l.SIGINT)
print("Press CTRL-C...")


sig, errno = l.sigwait(s, l.SIGINT)

if sig == l.SIGINT then
	print("PASS")
else
	print(("FAIL (expected sig to be %d but it is %d)"):format(l.SIGINT, sig))
end