Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
7510e58b
Commit
7510e58b
authored
9 years ago
by
Nicolas Noble
Browse files
Options
Downloads
Plain Diff
Merge pull request #2282 from ctiller/red-orange-yellow-green-blue-indigo-violet
Fix a TSAN reported race
parents
1aa4bc08
2daa88cf
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/core/iomgr/fd_posix.c
+2
-2
2 additions, 2 deletions
src/core/iomgr/fd_posix.c
src/core/iomgr/pollset_multipoller_with_epoll.c
+17
-9
17 additions, 9 deletions
src/core/iomgr/pollset_multipoller_with_epoll.c
with
19 additions
and
11 deletions
src/core/iomgr/fd_posix.c
+
2
−
2
View file @
7510e58b
...
...
@@ -371,13 +371,13 @@ gpr_uint32 grpc_fd_begin_poll(grpc_fd *fd, grpc_pollset *pollset,
return
0
;
}
/* if there is nobody polling for read, but we need to, then start doing so */
if
(
!
fd
->
read_watcher
&&
gpr_atm_acq_load
(
&
fd
->
readst
)
>
READY
)
{
if
(
read_mask
&&
!
fd
->
read_watcher
&&
gpr_atm_acq_load
(
&
fd
->
readst
)
>
READY
)
{
fd
->
read_watcher
=
watcher
;
mask
|=
read_mask
;
}
/* if there is nobody polling for write, but we need to, then start doing so
*/
if
(
!
fd
->
write_watcher
&&
gpr_atm_acq_load
(
&
fd
->
writest
)
>
READY
)
{
if
(
write_mask
&&
!
fd
->
write_watcher
&&
gpr_atm_acq_load
(
&
fd
->
writest
)
>
READY
)
{
fd
->
write_watcher
=
watcher
;
mask
|=
write_mask
;
}
...
...
This diff is collapsed.
Click to expand it.
src/core/iomgr/pollset_multipoller_with_epoll.c
+
17
−
9
View file @
7510e58b
...
...
@@ -54,17 +54,25 @@ static void multipoll_with_epoll_pollset_add_fd(grpc_pollset *pollset,
pollset_hdr
*
h
=
pollset
->
data
.
ptr
;
struct
epoll_event
ev
;
int
err
;
ev
.
events
=
EPOLLIN
|
EPOLLOUT
|
EPOLLET
;
ev
.
data
.
ptr
=
fd
;
err
=
epoll_ctl
(
h
->
epoll_fd
,
EPOLL_CTL_ADD
,
fd
->
fd
,
&
ev
);
if
(
err
<
0
)
{
/* FDs may be added to a pollset multiple times, so EEXIST is normal. */
if
(
errno
!=
EEXIST
)
{
gpr_log
(
GPR_ERROR
,
"epoll_ctl add for %d failed: %s"
,
fd
->
fd
,
strerror
(
errno
));
grpc_fd_watcher
watcher
;
/* We pretend to be polling whilst adding an fd to keep the fd from being
closed during the add. This may result in a spurious wakeup being assigned
to this pollset whilst adding, but that should be benign. */
GPR_ASSERT
(
grpc_fd_begin_poll
(
fd
,
pollset
,
0
,
0
,
&
watcher
)
==
0
);
if
(
watcher
.
fd
!=
NULL
)
{
ev
.
events
=
EPOLLIN
|
EPOLLOUT
|
EPOLLET
;
ev
.
data
.
ptr
=
fd
;
err
=
epoll_ctl
(
h
->
epoll_fd
,
EPOLL_CTL_ADD
,
fd
->
fd
,
&
ev
);
if
(
err
<
0
)
{
/* FDs may be added to a pollset multiple times, so EEXIST is normal. */
if
(
errno
!=
EEXIST
)
{
gpr_log
(
GPR_ERROR
,
"epoll_ctl add for %d failed: %s"
,
fd
->
fd
,
strerror
(
errno
));
}
}
}
grpc_fd_end_poll
(
&
watcher
,
0
,
0
);
}
static
void
multipoll_with_epoll_pollset_del_fd
(
grpc_pollset
*
pollset
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment