Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
9bcc407c
Commit
9bcc407c
authored
Jan 18, 2020
by
Guillaume Papin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for FdObserver(..., flags=0)::whenWriteDisconnected() support
Fixes #924
parent
eceea164
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
async-unix-test.c++
c++/src/kj/async-unix-test.c++
+27
-0
No files found.
c++/src/kj/async-unix-test.c++
View file @
9bcc407c
...
...
@@ -856,6 +856,33 @@ KJ_TEST("UnixEventPort whenWriteDisconnected()") {
hupPromise
.
wait
(
waitScope
);
}
KJ_TEST
(
"UnixEventPort FdObserver(..., flags=0)::whenWriteDisconnected()"
)
{
// Verifies that given `0' as a `flags' argument,
// FdObserver still observes whenWriteDisconnected().
//
// This can be useful to watch disconnection on a blocking file descriptor.
// See discussion: https://github.com/capnproto/capnproto/issues/924
captureSignals
();
UnixEventPort
port
;
EventLoop
loop
(
port
);
WaitScope
waitScope
(
loop
);
int
pipefds
[
2
];
KJ_SYSCALL
(
pipe
(
pipefds
));
kj
::
AutoCloseFd
infd
(
pipefds
[
0
]),
outfd
(
pipefds
[
1
]);
UnixEventPort
::
FdObserver
observer
(
port
,
outfd
,
0
);
auto
hupPromise
=
observer
.
whenWriteDisconnected
();
KJ_EXPECT
(
!
hupPromise
.
poll
(
waitScope
));
infd
=
nullptr
;
KJ_ASSERT
(
hupPromise
.
poll
(
waitScope
));
hupPromise
.
wait
(
waitScope
);
}
#endif
KJ_TEST
(
"UnixEventPort poll for signals"
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment