File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ _ = [[
3+ . "${0%%/*}/regress.sh"
4+ exec runlua "$0" "$@"
5+ ]]
6+ require " regress" .export " .*"
7+
8+ local cq = cqueues .new ()
9+ local rd , wr = check (socket .pair ())
10+ local pre_poll = false
11+ local post_poll = false
12+ cq :wrap (function ()
13+ pre_poll = true
14+ cqueues .poll ({
15+ pollfd = rd :pollfd ();
16+ events = " r" ;
17+ })
18+ post_poll = true
19+ end )
20+ assert (cq :step (0 ))
21+ check (pre_poll and not post_poll )
22+
23+ local r , w , p = cq :pollset ()
24+ check (r .n == 1 and r [1 ] == rd :pollfd (), " read set doesn't contain expected values" )
25+ check (w .n == 0 , " write set doesn't contain expected values" )
26+ check (p .n == 0 , " priority set doesn't contain expected values" )
27+
28+ assert (cq :step (0 ))
29+ check (not post_poll , " Thread was unexpectedly advanced" )
30+
31+ cqueues .cancel (rd )
32+ assert (cq :step (0 ))
33+
34+ check (post_poll , " Thread wasn't advanced" )
35+
36+ say (" OK" )
You can’t perform that action at this time.
0 commit comments