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
8c2946a5
Commit
8c2946a5
authored
8 years ago
by
murgatroid99
Browse files
Options
Downloads
Patches
Plain Diff
Fix missing wakeups when using the libuv iomgr under Electron
parent
5eb24eea
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
binding.gyp
+1
-3
1 addition, 3 deletions
binding.gyp
src/core/lib/iomgr/pollset_uv.c
+19
-3
19 additions, 3 deletions
src/core/lib/iomgr/pollset_uv.c
templates/binding.gyp.template
+1
-3
1 addition, 3 deletions
templates/binding.gyp.template
with
21 additions
and
9 deletions
binding.gyp
+
1
−
3
View file @
8c2946a5
...
@@ -54,10 +54,8 @@
...
@@ -54,10 +54,8 @@
'GPR_BACKWARDS_COMPATIBILITY_MODE'
'GPR_BACKWARDS_COMPATIBILITY_MODE'
],
],
'conditions': [
'conditions': [
['
runtime=="node" and
grpc_uv=="true"', {
['grpc_uv=="true"', {
'defines': [
'defines': [
# Disabling this while bugs are ironed out. Uncomment this to
# re-enable libuv integration in C core.
'GRPC_UV'
'GRPC_UV'
]
]
}],
}],
...
...
This diff is collapsed.
Click to expand it.
src/core/lib/iomgr/pollset_uv.c
+
19
−
3
View file @
8c2946a5
...
@@ -57,14 +57,28 @@ int grpc_pollset_work_run_loop;
...
@@ -57,14 +57,28 @@ int grpc_pollset_work_run_loop;
gpr_mu
grpc_polling_mu
;
gpr_mu
grpc_polling_mu
;
/* This is used solely to kick the uv loop, by setting a callback to be run
immediately in the next loop iteration.
Note: In the future, if there is a bug that involves missing wakeups in the
future, try adding a uv_async_t to kick the loop differently */
uv_timer_t
dummy_uv_handle
;
size_t
grpc_pollset_size
()
{
return
sizeof
(
grpc_pollset
);
}
size_t
grpc_pollset_size
()
{
return
sizeof
(
grpc_pollset
);
}
void
dummy_timer_cb
(
uv_timer_t
*
handle
)
{}
void
grpc_pollset_global_init
(
void
)
{
void
grpc_pollset_global_init
(
void
)
{
gpr_mu_init
(
&
grpc_polling_mu
);
gpr_mu_init
(
&
grpc_polling_mu
);
uv_timer_init
(
uv_default_loop
(),
&
dummy_uv_handle
);
grpc_pollset_work_run_loop
=
1
;
grpc_pollset_work_run_loop
=
1
;
}
}
void
grpc_pollset_global_shutdown
(
void
)
{
gpr_mu_destroy
(
&
grpc_polling_mu
);
}
static
void
timer_close_cb
(
uv_handle_t
*
handle
)
{
handle
->
data
=
(
void
*
)
1
;
}
void
grpc_pollset_global_shutdown
(
void
)
{
gpr_mu_destroy
(
&
grpc_polling_mu
);
uv_close
((
uv_handle_t
*
)
&
dummy_uv_handle
,
timer_close_cb
);
}
void
grpc_pollset_init
(
grpc_pollset
*
pollset
,
gpr_mu
**
mu
)
{
void
grpc_pollset_init
(
grpc_pollset
*
pollset
,
gpr_mu
**
mu
)
{
*
mu
=
&
grpc_polling_mu
;
*
mu
=
&
grpc_polling_mu
;
...
@@ -73,8 +87,6 @@ void grpc_pollset_init(grpc_pollset *pollset, gpr_mu **mu) {
...
@@ -73,8 +87,6 @@ void grpc_pollset_init(grpc_pollset *pollset, gpr_mu **mu) {
pollset
->
shutting_down
=
0
;
pollset
->
shutting_down
=
0
;
}
}
static
void
timer_close_cb
(
uv_handle_t
*
handle
)
{
handle
->
data
=
(
void
*
)
1
;
}
void
grpc_pollset_shutdown
(
grpc_exec_ctx
*
exec_ctx
,
grpc_pollset
*
pollset
,
void
grpc_pollset_shutdown
(
grpc_exec_ctx
*
exec_ctx
,
grpc_pollset
*
pollset
,
grpc_closure
*
closure
)
{
grpc_closure
*
closure
)
{
GPR_ASSERT
(
!
pollset
->
shutting_down
);
GPR_ASSERT
(
!
pollset
->
shutting_down
);
...
@@ -82,6 +94,9 @@ void grpc_pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
...
@@ -82,6 +94,9 @@ void grpc_pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
if
(
grpc_pollset_work_run_loop
)
{
if
(
grpc_pollset_work_run_loop
)
{
// Drain any pending UV callbacks without blocking
// Drain any pending UV callbacks without blocking
uv_run
(
uv_default_loop
(),
UV_RUN_NOWAIT
);
uv_run
(
uv_default_loop
(),
UV_RUN_NOWAIT
);
}
else
{
// kick the loop once
uv_timer_start
(
&
dummy_uv_handle
,
dummy_timer_cb
,
0
,
0
);
}
}
grpc_closure_sched
(
exec_ctx
,
closure
,
GRPC_ERROR_NONE
);
grpc_closure_sched
(
exec_ctx
,
closure
,
GRPC_ERROR_NONE
);
}
}
...
@@ -136,6 +151,7 @@ grpc_error *grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
...
@@ -136,6 +151,7 @@ grpc_error *grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
grpc_error
*
grpc_pollset_kick
(
grpc_pollset
*
pollset
,
grpc_error
*
grpc_pollset_kick
(
grpc_pollset
*
pollset
,
grpc_pollset_worker
*
specific_worker
)
{
grpc_pollset_worker
*
specific_worker
)
{
uv_timer_start
(
&
dummy_uv_handle
,
dummy_timer_cb
,
0
,
0
);
return
GRPC_ERROR_NONE
;
return
GRPC_ERROR_NONE
;
}
}
...
...
This diff is collapsed.
Click to expand it.
templates/binding.gyp.template
+
1
−
3
View file @
8c2946a5
...
@@ -56,10 +56,8 @@
...
@@ -56,10 +56,8 @@
'GPR_BACKWARDS_COMPATIBILITY_MODE'
'GPR_BACKWARDS_COMPATIBILITY_MODE'
],
],
'conditions': [
'conditions': [
['
runtime=="node" and
grpc_uv=="true"', {
['grpc_uv=="true"', {
'defines': [
'defines': [
# Disabling this while bugs are ironed out. Uncomment this to
# re-enable libuv integration in C core.
'GRPC_UV'
'GRPC_UV'
]
]
}],
}],
...
...
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