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
f5fd4ba0
Commit
f5fd4ba0
authored
10 years ago
by
Craig Tiller
Browse files
Options
Downloads
Patches
Plain Diff
Completion queue cleanup
Make debugging a little easier, and remove an unnecessary assert
parent
479f2b25
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/surface/completion_queue.c
+6
-1
6 additions, 1 deletion
src/core/surface/completion_queue.c
with
6 additions
and
1 deletion
src/core/surface/completion_queue.c
+
6
−
1
View file @
f5fd4ba0
...
...
@@ -71,6 +71,7 @@ struct grpc_completion_queue {
grpc_pollset
pollset
;
/* 0 initially, 1 once we've begun shutting down */
int
shutdown
;
int
shutdown_called
;
/* Head of a linked list of queued events (prev points to the last element) */
event
*
queue
;
/* Fixed size chained hash table of events for pluck() */
...
...
@@ -107,7 +108,6 @@ static event *add_locked(grpc_completion_queue *cc, grpc_completion_type type,
grpc_event_finish_func
on_finish
,
void
*
user_data
)
{
event
*
ev
=
gpr_malloc
(
sizeof
(
event
));
gpr_uintptr
bucket
=
((
gpr_uintptr
)
tag
)
%
NUM_TAG_BUCKETS
;
GPR_ASSERT
(
!
cc
->
shutdown
);
ev
->
base
.
type
=
type
;
ev
->
base
.
tag
=
tag
;
ev
->
base
.
call
=
call
;
...
...
@@ -150,6 +150,7 @@ static void end_op_locked(grpc_completion_queue *cc,
#endif
if
(
gpr_unref
(
&
cc
->
refs
))
{
GPR_ASSERT
(
!
cc
->
shutdown
);
GPR_ASSERT
(
cc
->
shutdown_called
);
cc
->
shutdown
=
1
;
gpr_cv_broadcast
(
GRPC_POLLSET_CV
(
&
cc
->
pollset
));
}
...
...
@@ -380,6 +381,10 @@ grpc_event *grpc_completion_queue_pluck(grpc_completion_queue *cc, void *tag,
/* Shutdown simply drops a ref that we reserved at creation time; if we drop
to zero here, then enter shutdown mode and wake up any waiters */
void
grpc_completion_queue_shutdown
(
grpc_completion_queue
*
cc
)
{
gpr_mu_lock
(
GRPC_POLLSET_MU
(
&
cc
->
pollset
));
cc
->
shutdown_called
=
1
;
gpr_mu_unlock
(
GRPC_POLLSET_MU
(
&
cc
->
pollset
));
if
(
gpr_unref
(
&
cc
->
refs
))
{
gpr_mu_lock
(
GRPC_POLLSET_MU
(
&
cc
->
pollset
));
GPR_ASSERT
(
!
cc
->
shutdown
);
...
...
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