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
c6993428
Commit
c6993428
authored
9 years ago
by
vjpai
Browse files
Options
Downloads
Patches
Plain Diff
Lock the FD when initializing it out of the freelist.
parent
fb6e13b1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/iomgr/fd_posix.c
+3
-7
3 additions, 7 deletions
src/core/iomgr/fd_posix.c
with
3 additions
and
7 deletions
src/core/iomgr/fd_posix.c
+
3
−
7
View file @
c6993428
...
@@ -72,9 +72,6 @@ static grpc_fd *fd_freelist = NULL;
...
@@ -72,9 +72,6 @@ static grpc_fd *fd_freelist = NULL;
static
gpr_mu
fd_freelist_mu
;
static
gpr_mu
fd_freelist_mu
;
static
void
freelist_fd
(
grpc_fd
*
fd
)
{
static
void
freelist_fd
(
grpc_fd
*
fd
)
{
// Note that this function must be called after a release store (or
// full-barrier operation) on refst so that prior actions on the fd are
// ordered before the fd becomes visible to the freelist
gpr_mu_lock
(
&
fd_freelist_mu
);
gpr_mu_lock
(
&
fd_freelist_mu
);
fd
->
freelist_next
=
fd_freelist
;
fd
->
freelist_next
=
fd_freelist
;
fd_freelist
=
fd
;
fd_freelist
=
fd
;
...
@@ -95,6 +92,7 @@ static grpc_fd *alloc_fd(int fd) {
...
@@ -95,6 +92,7 @@ static grpc_fd *alloc_fd(int fd) {
gpr_mu_init
(
&
r
->
mu
);
gpr_mu_init
(
&
r
->
mu
);
}
}
gpr_mu_lock
(
&
r
->
mu
);
r
->
shutdown
=
0
;
r
->
shutdown
=
0
;
r
->
read_closure
=
CLOSURE_NOT_READY
;
r
->
read_closure
=
CLOSURE_NOT_READY
;
r
->
write_closure
=
CLOSURE_NOT_READY
;
r
->
write_closure
=
CLOSURE_NOT_READY
;
...
@@ -106,11 +104,9 @@ static grpc_fd *alloc_fd(int fd) {
...
@@ -106,11 +104,9 @@ static grpc_fd *alloc_fd(int fd) {
r
->
on_done_closure
=
NULL
;
r
->
on_done_closure
=
NULL
;
r
->
closed
=
0
;
r
->
closed
=
0
;
r
->
released
=
0
;
r
->
released
=
0
;
// The last operation on r before returning it should be a release-store
// so that all the above fields are globally visible before the value of
// r could escape to another thread. Our refcount itself needs a release-store
// so use this
gpr_atm_rel_store
(
&
r
->
refst
,
1
);
gpr_atm_rel_store
(
&
r
->
refst
,
1
);
gpr_mu_unlock
(
&
r
->
mu
);
return
r
;
return
r
;
}
}
...
...
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