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
2ea16591
Commit
2ea16591
authored
8 years ago
by
Sree Kuchibhotla
Browse files
Options
Downloads
Patches
Plain Diff
experiment with signals
parent
c22eb5ac
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/lib/iomgr/ev_epoll_posix.c
+12
-0
12 additions, 0 deletions
src/core/lib/iomgr/ev_epoll_posix.c
with
12 additions
and
0 deletions
src/core/lib/iomgr/ev_epoll_posix.c
+
12
−
0
View file @
2ea16591
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
#include
<assert.h>
#include
<assert.h>
#include
<errno.h>
#include
<errno.h>
#include
<poll.h>
#include
<poll.h>
#include
<signal.h>
#include
<string.h>
#include
<string.h>
#include
<sys/socket.h>
#include
<sys/socket.h>
#include
<unistd.h>
#include
<unistd.h>
...
@@ -120,6 +121,7 @@ struct grpc_pollset_worker {
...
@@ -120,6 +121,7 @@ struct grpc_pollset_worker {
grpc_cached_wakeup_fd
*
wakeup_fd
;
grpc_cached_wakeup_fd
*
wakeup_fd
;
int
reevaluate_polling_on_wakeup
;
int
reevaluate_polling_on_wakeup
;
int
kicked_specifically
;
int
kicked_specifically
;
pthread_t
pt_id
;
struct
grpc_pollset_worker
*
next
;
struct
grpc_pollset_worker
*
next
;
struct
grpc_pollset_worker
*
prev
;
struct
grpc_pollset_worker
*
prev
;
};
};
...
@@ -506,6 +508,8 @@ static void pollset_kick_ext(grpc_pollset *p,
...
@@ -506,6 +508,8 @@ static void pollset_kick_ext(grpc_pollset *p,
}
}
specific_worker
->
kicked_specifically
=
1
;
specific_worker
->
kicked_specifically
=
1
;
grpc_wakeup_fd_wakeup
(
&
specific_worker
->
wakeup_fd
->
fd
);
grpc_wakeup_fd_wakeup
(
&
specific_worker
->
wakeup_fd
->
fd
);
/* TODO (sreek): Refactor this into a separate file*/
pthread_kill
(
specific_worker
->
pt_id
,
SIGUSR1
);
}
else
if
((
flags
&
GRPC_POLLSET_CAN_KICK_SELF
)
!=
0
)
{
}
else
if
((
flags
&
GRPC_POLLSET_CAN_KICK_SELF
)
!=
0
)
{
GPR_TIMER_MARK
(
"kick_yoself"
,
0
);
GPR_TIMER_MARK
(
"kick_yoself"
,
0
);
if
((
flags
&
GRPC_POLLSET_REEVALUATE_POLLING_ON_WAKEUP
)
!=
0
)
{
if
((
flags
&
GRPC_POLLSET_REEVALUATE_POLLING_ON_WAKEUP
)
!=
0
)
{
...
@@ -551,10 +555,15 @@ static void pollset_kick(grpc_pollset *p,
...
@@ -551,10 +555,15 @@ static void pollset_kick(grpc_pollset *p,
/* global state management */
/* global state management */
static
void
sig_handler
(
int
sig_num
)
{
gpr_log
(
GPR_INFO
,
"Received signal %d"
,
sig_num
);
}
static
void
pollset_global_init
(
void
)
{
static
void
pollset_global_init
(
void
)
{
gpr_tls_init
(
&
g_current_thread_poller
);
gpr_tls_init
(
&
g_current_thread_poller
);
gpr_tls_init
(
&
g_current_thread_worker
);
gpr_tls_init
(
&
g_current_thread_worker
);
grpc_wakeup_fd_init
(
&
grpc_global_wakeup_fd
);
grpc_wakeup_fd_init
(
&
grpc_global_wakeup_fd
);
signal
(
SIGUSR1
,
sig_handler
);
}
}
static
void
pollset_global_shutdown
(
void
)
{
static
void
pollset_global_shutdown
(
void
)
{
...
@@ -663,6 +672,9 @@ static void pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
...
@@ -663,6 +672,9 @@ static void pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
grpc_wakeup_fd_init
(
&
worker
.
wakeup_fd
->
fd
);
grpc_wakeup_fd_init
(
&
worker
.
wakeup_fd
->
fd
);
}
}
worker
.
kicked_specifically
=
0
;
worker
.
kicked_specifically
=
0
;
/* TODO(sreek): Abstract this thread id stuff out into a separate file */
worker
.
pt_id
=
pthread_self
();
/* If we're shutting down then we don't execute any extended work */
/* If we're shutting down then we don't execute any extended work */
if
(
pollset
->
shutting_down
)
{
if
(
pollset
->
shutting_down
)
{
GPR_TIMER_MARK
(
"pollset_work.shutting_down"
,
0
);
GPR_TIMER_MARK
(
"pollset_work.shutting_down"
,
0
);
...
...
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