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
85b67d42
Commit
85b67d42
authored
Jul 04, 2019
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix poll()-based UnixEventPort::wake().
parent
2b583ab7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
async-unix.c++
c++/src/kj/async-unix.c++
+13
-4
No files found.
c++/src/kj/async-unix.c++
View file @
85b67d42
...
...
@@ -100,8 +100,6 @@ void registerReservedSignal() {
}
}
pthread_once_t
registerReservedSignalOnce
=
PTHREAD_ONCE_INIT
;
}
// namespace
struct
UnixEventPort
::
ChildSet
{
...
...
@@ -280,7 +278,10 @@ UnixEventPort::UnixEventPort()
epollFd
(
-
1
),
signalFd
(
-
1
),
eventFd
(
-
1
)
{
pthread_once
(
&
registerReservedSignalOnce
,
&
registerReservedSignal
);
// TODO(cleanup): We don't use the reserved signal on Linux; we use an eventfd instead. Should we
// skip registering it? Note that registerReservedSignal() also takes care of blocking SIGPIPE
// which is important.
registerReservedSignal
();
int
fd
;
KJ_SYSCALL
(
fd
=
epoll_create1
(
EPOLL_CLOEXEC
));
...
...
@@ -614,7 +615,15 @@ UnixEventPort::UnixEventPort()
"pthread_t is larger than a long long on your platform. Please port."
);
*
reinterpret_cast
<
pthread_t
*>
(
&
threadId
)
=
pthread_self
();
pthread_once
(
&
registerReservedSignalOnce
,
&
registerReservedSignal
);
// Note: We used to use a pthread_once to call registerReservedSignal() only once per process.
// This didn't work correctly because registerReservedSignal() not only registers the
// (process-wide) signal handler, but also sets the (per-thread) signal mask to block the
// signal. Thus, if threads were spawned before the first UnixEventPort was created, and then
// multiple threads created UnixEventPorts, only one of them would have the signal properly
// blocked. We could have changed things so that only the handler registration was protected
// by the pthread_once and the mask update happened in every thread, but registering a signal
// handler is not an expensive operation, so whatever... we'll do it in every thread.
registerReservedSignal
();
}
UnixEventPort
::~
UnixEventPort
()
noexcept
(
false
)
{}
...
...
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