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
34bb6df1
Commit
34bb6df1
authored
8 years ago
by
Alexander Polcyn
Browse files
Options
Downloads
Patches
Plain Diff
allocated run batch stack on the heap
parent
27338de4
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/ruby/ext/grpc/rb_call.c
+11
-7
11 additions, 7 deletions
src/ruby/ext/grpc/rb_call.c
with
11 additions
and
7 deletions
src/ruby/ext/grpc/rb_call.c
+
11
−
7
View file @
34bb6df1
...
@@ -784,7 +784,7 @@ static VALUE grpc_run_batch_stack_build_result(run_batch_stack *st) {
...
@@ -784,7 +784,7 @@ static VALUE grpc_run_batch_stack_build_result(run_batch_stack *st) {
Only one operation of each type can be active at once in any given
Only one operation of each type can be active at once in any given
batch */
batch */
static
VALUE
grpc_rb_call_run_batch
(
VALUE
self
,
VALUE
ops_hash
)
{
static
VALUE
grpc_rb_call_run_batch
(
VALUE
self
,
VALUE
ops_hash
)
{
run_batch_stack
st
;
run_batch_stack
*
st
;
grpc_rb_call
*
call
=
NULL
;
grpc_rb_call
*
call
=
NULL
;
grpc_event
ev
;
grpc_event
ev
;
grpc_call_error
err
;
grpc_call_error
err
;
...
@@ -792,6 +792,8 @@ static VALUE grpc_rb_call_run_batch(VALUE self, VALUE ops_hash) {
...
@@ -792,6 +792,8 @@ static VALUE grpc_rb_call_run_batch(VALUE self, VALUE ops_hash) {
VALUE
rb_write_flag
=
rb_ivar_get
(
self
,
id_write_flag
);
VALUE
rb_write_flag
=
rb_ivar_get
(
self
,
id_write_flag
);
unsigned
write_flag
=
0
;
unsigned
write_flag
=
0
;
void
*
tag
=
(
void
*
)
&
st
;
void
*
tag
=
(
void
*
)
&
st
;
st
=
gpr_malloc
(
sizeof
(
run_batch_stack
));
if
(
RTYPEDDATA_DATA
(
self
)
==
NULL
)
{
if
(
RTYPEDDATA_DATA
(
self
)
==
NULL
)
{
rb_raise
(
grpc_rb_eCallError
,
"Cannot run batch on closed call"
);
rb_raise
(
grpc_rb_eCallError
,
"Cannot run batch on closed call"
);
return
Qnil
;
return
Qnil
;
...
@@ -806,14 +808,15 @@ static VALUE grpc_rb_call_run_batch(VALUE self, VALUE ops_hash) {
...
@@ -806,14 +808,15 @@ static VALUE grpc_rb_call_run_batch(VALUE self, VALUE ops_hash) {
if
(
rb_write_flag
!=
Qnil
)
{
if
(
rb_write_flag
!=
Qnil
)
{
write_flag
=
NUM2UINT
(
rb_write_flag
);
write_flag
=
NUM2UINT
(
rb_write_flag
);
}
}
grpc_run_batch_stack_init
(
&
st
,
write_flag
);
grpc_run_batch_stack_init
(
st
,
write_flag
);
grpc_run_batch_stack_fill_ops
(
&
st
,
ops_hash
);
grpc_run_batch_stack_fill_ops
(
st
,
ops_hash
);
/* call grpc_call_start_batch, then wait for it to complete using
/* call grpc_call_start_batch, then wait for it to complete using
* pluck_event */
* pluck_event */
err
=
grpc_call_start_batch
(
call
->
wrapped
,
st
.
ops
,
st
.
op_num
,
tag
,
NULL
);
err
=
grpc_call_start_batch
(
call
->
wrapped
,
st
->
ops
,
st
->
op_num
,
tag
,
NULL
);
if
(
err
!=
GRPC_CALL_OK
)
{
if
(
err
!=
GRPC_CALL_OK
)
{
grpc_run_batch_stack_cleanup
(
&
st
);
grpc_run_batch_stack_cleanup
(
st
);
gpr_free
(
st
);
rb_raise
(
grpc_rb_eCallError
,
rb_raise
(
grpc_rb_eCallError
,
"grpc_call_start_batch failed with %s (code=%d)"
,
"grpc_call_start_batch failed with %s (code=%d)"
,
grpc_call_error_detail_of
(
err
),
err
);
grpc_call_error_detail_of
(
err
),
err
);
...
@@ -826,8 +829,9 @@ static VALUE grpc_rb_call_run_batch(VALUE self, VALUE ops_hash) {
...
@@ -826,8 +829,9 @@ static VALUE grpc_rb_call_run_batch(VALUE self, VALUE ops_hash) {
}
}
/* Build and return the BatchResult struct result,
/* Build and return the BatchResult struct result,
if there is an error, it's reflected in the status */
if there is an error, it's reflected in the status */
result
=
grpc_run_batch_stack_build_result
(
&
st
);
result
=
grpc_run_batch_stack_build_result
(
st
);
grpc_run_batch_stack_cleanup
(
&
st
);
grpc_run_batch_stack_cleanup
(
st
);
gpr_free
(
st
);
return
result
;
return
result
;
}
}
...
...
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