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
32c804e6
Commit
32c804e6
authored
8 years ago
by
Craig Tiller
Browse files
Options
Downloads
Patches
Plain Diff
Fix a conditional that got flipped
parent
dd339ea9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/core/lib/iomgr/buffer_pool.c
+10
-6
10 additions, 6 deletions
src/core/lib/iomgr/buffer_pool.c
src/core/lib/iomgr/buffer_pool.h
+2
-0
2 additions, 0 deletions
src/core/lib/iomgr/buffer_pool.h
test/core/iomgr/buffer_pool_test.c
+18
-1
18 additions, 1 deletion
test/core/iomgr/buffer_pool_test.c
with
30 additions
and
7 deletions
src/core/lib/iomgr/buffer_pool.c
+
10
−
6
View file @
32c804e6
...
@@ -337,11 +337,6 @@ static void bu_destroy(grpc_exec_ctx *exec_ctx, void *bu, grpc_error *error) {
...
@@ -337,11 +337,6 @@ static void bu_destroy(grpc_exec_ctx *exec_ctx, void *bu, grpc_error *error) {
buffer_user
->
buffer_pool
->
free_pool
+=
buffer_user
->
free_pool
;
buffer_user
->
buffer_pool
->
free_pool
+=
buffer_user
->
free_pool
;
bpstep_sched
(
exec_ctx
,
buffer_user
->
buffer_pool
);
bpstep_sched
(
exec_ctx
,
buffer_user
->
buffer_pool
);
}
}
#ifndef NDEBUG
gpr_free
(
buffer_user
->
asan_canary
);
#endif
grpc_buffer_pool_internal_unref
(
exec_ctx
,
buffer_user
->
buffer_pool
);
gpr_mu_destroy
(
&
buffer_user
->
mu
);
}
}
static
void
bu_allocated_slices
(
grpc_exec_ctx
*
exec_ctx
,
void
*
ts
,
static
void
bu_allocated_slices
(
grpc_exec_ctx
*
exec_ctx
,
void
*
ts
,
...
@@ -521,6 +516,15 @@ void grpc_buffer_user_shutdown(grpc_exec_ctx *exec_ctx,
...
@@ -521,6 +516,15 @@ void grpc_buffer_user_shutdown(grpc_exec_ctx *exec_ctx,
gpr_mu_unlock
(
&
buffer_user
->
mu
);
gpr_mu_unlock
(
&
buffer_user
->
mu
);
}
}
void
grpc_buffer_user_destroy
(
grpc_exec_ctx
*
exec_ctx
,
grpc_buffer_user
*
buffer_user
)
{
#ifndef NDEBUG
gpr_free
(
buffer_user
->
asan_canary
);
#endif
grpc_buffer_pool_internal_unref
(
exec_ctx
,
buffer_user
->
buffer_pool
);
gpr_mu_destroy
(
&
buffer_user
->
mu
);
}
void
grpc_buffer_user_alloc
(
grpc_exec_ctx
*
exec_ctx
,
void
grpc_buffer_user_alloc
(
grpc_exec_ctx
*
exec_ctx
,
grpc_buffer_user
*
buffer_user
,
size_t
size
,
grpc_buffer_user
*
buffer_user
,
size_t
size
,
grpc_closure
*
optional_on_done
)
{
grpc_closure
*
optional_on_done
)
{
...
@@ -580,7 +584,7 @@ void grpc_buffer_user_free(grpc_exec_ctx *exec_ctx,
...
@@ -580,7 +584,7 @@ void grpc_buffer_user_free(grpc_exec_ctx *exec_ctx,
void
grpc_buffer_user_post_reclaimer
(
grpc_exec_ctx
*
exec_ctx
,
void
grpc_buffer_user_post_reclaimer
(
grpc_exec_ctx
*
exec_ctx
,
grpc_buffer_user
*
buffer_user
,
grpc_buffer_user
*
buffer_user
,
bool
destructive
,
grpc_closure
*
closure
)
{
bool
destructive
,
grpc_closure
*
closure
)
{
if
(
gpr_atm_acq_load
(
&
buffer_user
->
on_done_destroy_closure
)
!
=
0
)
{
if
(
gpr_atm_acq_load
(
&
buffer_user
->
on_done_destroy_closure
)
=
=
0
)
{
GPR_ASSERT
(
buffer_user
->
reclaimers
[
destructive
]
==
NULL
);
GPR_ASSERT
(
buffer_user
->
reclaimers
[
destructive
]
==
NULL
);
buffer_user
->
reclaimers
[
destructive
]
=
closure
;
buffer_user
->
reclaimers
[
destructive
]
=
closure
;
grpc_combiner_execute
(
exec_ctx
,
buffer_user
->
buffer_pool
->
combiner
,
grpc_combiner_execute
(
exec_ctx
,
buffer_user
->
buffer_pool
->
combiner
,
...
...
This diff is collapsed.
Click to expand it.
src/core/lib/iomgr/buffer_pool.h
+
2
−
0
View file @
32c804e6
...
@@ -90,6 +90,8 @@ void grpc_buffer_user_init(grpc_buffer_user *buffer_user,
...
@@ -90,6 +90,8 @@ void grpc_buffer_user_init(grpc_buffer_user *buffer_user,
void
grpc_buffer_user_shutdown
(
grpc_exec_ctx
*
exec_ctx
,
void
grpc_buffer_user_shutdown
(
grpc_exec_ctx
*
exec_ctx
,
grpc_buffer_user
*
buffer_user
,
grpc_buffer_user
*
buffer_user
,
grpc_closure
*
on_done
);
grpc_closure
*
on_done
);
void
grpc_buffer_user_destroy
(
grpc_exec_ctx
*
exec_ctx
,
grpc_buffer_user
*
buffer_user
);
void
grpc_buffer_user_alloc
(
grpc_exec_ctx
*
exec_ctx
,
void
grpc_buffer_user_alloc
(
grpc_exec_ctx
*
exec_ctx
,
grpc_buffer_user
*
buffer_user
,
size_t
size
,
grpc_buffer_user
*
buffer_user
,
size_t
size
,
...
...
This diff is collapsed.
Click to expand it.
test/core/iomgr/buffer_pool_test.c
+
18
−
1
View file @
32c804e6
...
@@ -83,8 +83,10 @@ static void destroy_user(grpc_buffer_user *usr) {
...
@@ -83,8 +83,10 @@ static void destroy_user(grpc_buffer_user *usr) {
grpc_exec_ctx
exec_ctx
=
GRPC_EXEC_CTX_INIT
;
grpc_exec_ctx
exec_ctx
=
GRPC_EXEC_CTX_INIT
;
bool
done
=
false
;
bool
done
=
false
;
grpc_buffer_user_shutdown
(
&
exec_ctx
,
usr
,
set_bool
(
&
done
));
grpc_buffer_user_shutdown
(
&
exec_ctx
,
usr
,
set_bool
(
&
done
));
grpc_exec_ctx_f
ini
sh
(
&
exec_ctx
);
grpc_exec_ctx_f
lu
sh
(
&
exec_ctx
);
GPR_ASSERT
(
done
);
GPR_ASSERT
(
done
);
grpc_buffer_user_destroy
(
&
exec_ctx
,
usr
);
grpc_exec_ctx_finish
(
&
exec_ctx
);
}
}
static
void
test_no_op
(
void
)
{
static
void
test_no_op
(
void
)
{
...
@@ -528,6 +530,11 @@ static void test_buffer_user_stays_allocated_until_memory_released(void) {
...
@@ -528,6 +530,11 @@ static void test_buffer_user_stays_allocated_until_memory_released(void) {
grpc_exec_ctx_finish
(
&
exec_ctx
);
grpc_exec_ctx_finish
(
&
exec_ctx
);
GPR_ASSERT
(
done
);
GPR_ASSERT
(
done
);
}
}
{
grpc_exec_ctx
exec_ctx
=
GRPC_EXEC_CTX_INIT
;
grpc_buffer_user_destroy
(
&
exec_ctx
,
&
usr
);
grpc_exec_ctx_finish
(
&
exec_ctx
);
}
}
}
static
void
test_pools_merged_on_buffer_user_deletion
(
void
)
{
static
void
test_pools_merged_on_buffer_user_deletion
(
void
)
{
...
@@ -569,6 +576,11 @@ static void test_pools_merged_on_buffer_user_deletion(void) {
...
@@ -569,6 +576,11 @@ static void test_pools_merged_on_buffer_user_deletion(void) {
GPR_ASSERT
(
done
);
GPR_ASSERT
(
done
);
GPR_ASSERT
(
reclaimer_cancelled
);
GPR_ASSERT
(
reclaimer_cancelled
);
}
}
{
grpc_exec_ctx
exec_ctx
=
GRPC_EXEC_CTX_INIT
;
grpc_buffer_user_destroy
(
&
exec_ctx
,
&
usr
);
grpc_exec_ctx_finish
(
&
exec_ctx
);
}
}
}
grpc_buffer_pool_unref
(
p
);
grpc_buffer_pool_unref
(
p
);
}
}
...
@@ -678,6 +690,11 @@ static void test_one_slice_deleted_late(void) {
...
@@ -678,6 +690,11 @@ static void test_one_slice_deleted_late(void) {
grpc_buffer_pool_unref
(
p
);
grpc_buffer_pool_unref
(
p
);
gpr_slice_buffer_destroy
(
&
buffer
);
gpr_slice_buffer_destroy
(
&
buffer
);
GPR_ASSERT
(
done
);
GPR_ASSERT
(
done
);
{
grpc_exec_ctx
exec_ctx
=
GRPC_EXEC_CTX_INIT
;
grpc_buffer_user_destroy
(
&
exec_ctx
,
&
usr
);
grpc_exec_ctx_finish
(
&
exec_ctx
);
}
}
}
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
...
...
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