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
24f0f57e
Commit
24f0f57e
authored
8 years ago
by
Sree Kuchibhotla
Browse files
Options
Downloads
Patches
Plain Diff
Moving the creation of epoll_fd to pollset_init() instead of
pollset_add_fd() [Verified stable. All tests pass]
parent
f6a2adf0
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
+14
-7
14 additions, 7 deletions
src/core/lib/iomgr/ev_epoll_posix.c
with
14 additions
and
7 deletions
src/core/lib/iomgr/ev_epoll_posix.c
+
14
−
7
View file @
24f0f57e
...
@@ -787,6 +787,9 @@ static void pollset_global_shutdown(void) {
...
@@ -787,6 +787,9 @@ static void pollset_global_shutdown(void) {
static
void
kick_poller
(
void
)
{
grpc_wakeup_fd_wakeup
(
&
grpc_global_wakeup_fd
);
}
static
void
kick_poller
(
void
)
{
grpc_wakeup_fd_wakeup
(
&
grpc_global_wakeup_fd
);
}
/* TODO: sreek. Try to Remove this forward declaration*/
static
void
multipoll_with_epoll_pollset_create_efd
(
grpc_pollset
*
pollset
);
/* main interface */
/* main interface */
static
void
pollset_init
(
grpc_pollset
*
pollset
,
gpr_mu
**
mu
)
{
static
void
pollset_init
(
grpc_pollset
*
pollset
,
gpr_mu
**
mu
)
{
...
@@ -800,7 +803,9 @@ static void pollset_init(grpc_pollset *pollset, gpr_mu **mu) {
...
@@ -800,7 +803,9 @@ static void pollset_init(grpc_pollset *pollset, gpr_mu **mu) {
pollset
->
idle_jobs
.
head
=
pollset
->
idle_jobs
.
tail
=
NULL
;
pollset
->
idle_jobs
.
head
=
pollset
->
idle_jobs
.
tail
=
NULL
;
pollset
->
local_wakeup_cache
=
NULL
;
pollset
->
local_wakeup_cache
=
NULL
;
pollset
->
kicked_without_pollers
=
0
;
pollset
->
kicked_without_pollers
=
0
;
pollset
->
data
.
ptr
=
NULL
;
pollset
->
data
.
ptr
=
NULL
;
multipoll_with_epoll_pollset_create_efd
(
pollset
);
}
}
/* TODO(sreek): Maybe merge multipoll_*_destroy() with pollset_destroy()
/* TODO(sreek): Maybe merge multipoll_*_destroy() with pollset_destroy()
...
@@ -1153,13 +1158,15 @@ static void finally_add_fd(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
...
@@ -1153,13 +1158,15 @@ static void finally_add_fd(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
}
}
/* Creates an epoll fd and initializes the pollset */
/* Creates an epoll fd and initializes the pollset */
static
void
multipoll_with_epoll_pollset_create_efd
(
grpc_exec_ctx
*
exec_ctx
,
/* TODO: This has to be called ONLY from pollset_init function. and hence it
grpc_pollset
*
pollset
)
{
* does not acquire any lock */
static
void
multipoll_with_epoll_pollset_create_efd
(
grpc_pollset
*
pollset
)
{
epoll_hdr
*
h
=
gpr_malloc
(
sizeof
(
epoll_hdr
));
epoll_hdr
*
h
=
gpr_malloc
(
sizeof
(
epoll_hdr
));
struct
epoll_event
ev
;
struct
epoll_event
ev
;
int
err
;
int
err
;
/* Ensuring that the pollset is infact empty (with no epoll fd either) */
/* TODO (sreek). remove this assert. Currently added this just to ensure that
* we do not overwrite h->epoll_fd without freeing the older one*/
GPR_ASSERT
(
pollset
->
data
.
ptr
==
NULL
);
GPR_ASSERT
(
pollset
->
data
.
ptr
==
NULL
);
pollset
->
data
.
ptr
=
h
;
pollset
->
data
.
ptr
=
h
;
...
@@ -1188,10 +1195,10 @@ static void multipoll_with_epoll_pollset_create_efd(grpc_exec_ctx *exec_ctx,
...
@@ -1188,10 +1195,10 @@ static void multipoll_with_epoll_pollset_create_efd(grpc_exec_ctx *exec_ctx,
static
void
multipoll_with_epoll_pollset_add_fd
(
grpc_exec_ctx
*
exec_ctx
,
static
void
multipoll_with_epoll_pollset_add_fd
(
grpc_exec_ctx
*
exec_ctx
,
grpc_pollset
*
pollset
,
grpc_pollset
*
pollset
,
grpc_fd
*
fd
)
{
grpc_fd
*
fd
)
{
/* If there is no epoll fd on the pollset, create one */
GPR_ASSERT
(
pollset
->
data
.
ptr
!=
NULL
);
if
(
pollset
->
data
.
ptr
==
NULL
)
{
multipoll_with_epoll_pollset_create_efd
(
exec_ctx
,
pollset
);
/* TODO(sreek). Remove this unlock code (and also the code that acquires the
}
* lock before calling multipoll_with_epoll_add_fd() function */
gpr_mu_unlock
(
&
pollset
->
mu
);
gpr_mu_unlock
(
&
pollset
->
mu
);
finally_add_fd
(
exec_ctx
,
pollset
,
fd
);
finally_add_fd
(
exec_ctx
,
pollset
,
fd
);
...
...
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