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
dfbb1c08
Commit
dfbb1c08
authored
8 years ago
by
Craig Tiller
Browse files
Options
Downloads
Patches
Plain Diff
Almost working......
parent
2743ba94
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/core/lib/iomgr/async_execution_lock.c
+10
-2
10 additions, 2 deletions
src/core/lib/iomgr/async_execution_lock.c
test/core/iomgr/async_execution_lock_test.c
+1
-1
1 addition, 1 deletion
test/core/iomgr/async_execution_lock_test.c
with
11 additions
and
3 deletions
src/core/lib/iomgr/async_execution_lock.c
+
10
−
2
View file @
dfbb1c08
...
@@ -67,23 +67,30 @@ static void finish(grpc_exec_ctx *exec_ctx, grpc_aelock *lock) {
...
@@ -67,23 +67,30 @@ static void finish(grpc_exec_ctx *exec_ctx, grpc_aelock *lock) {
NO_CONSUMER
))
{
NO_CONSUMER
))
{
return
;
return
;
}
}
// TODO(ctiller): consider sleeping
continue
;
}
else
{
}
else
{
// skip the tombstone: we'll re-add it later
lock
->
tail
=
next
;
lock
->
tail
=
next
;
tail
=
next
;
tail
=
next
;
next
=
(
grpc_aelock_qnode
*
)
gpr_atm_acq_load
(
&
tail
->
next
);
next
=
(
grpc_aelock_qnode
*
)
gpr_atm_acq_load
(
&
tail
->
next
);
}
}
}
}
if
(
next
!=
NULL
)
{
if
(
next
!=
NULL
)
{
// found a node
lock
->
tail
=
next
;
lock
->
tail
=
next
;
tail
->
action
(
exec_ctx
,
tail
->
arg
);
tail
->
action
(
exec_ctx
,
tail
->
arg
);
gpr_free
(
tail
);
gpr_free
(
tail
);
}
else
{
}
else
{
// nothing there: might be in an incosistant state
grpc_aelock_qnode
*
head
=
grpc_aelock_qnode
*
head
=
(
grpc_aelock_qnode
*
)
gpr_atm_acq_load
(
&
lock
->
head
);
(
grpc_aelock_qnode
*
)
gpr_atm_acq_load
(
&
lock
->
head
);
if
(
head
!=
tail
)
{
if
(
head
!=
tail
)
{
// non-empty list: spin for a bit
// TODO(ctiller): consider sleeping?
// TODO(ctiller): consider sleeping?
continue
;
continue
;
}
}
// must have swallowed tombstone above: re-add it
gpr_atm_no_barrier_store
(
&
lock
->
tombstone
.
next
,
0
);
gpr_atm_no_barrier_store
(
&
lock
->
tombstone
.
next
,
0
);
while
(
!
gpr_atm_rel_cas
(
&
lock
->
head
,
(
gpr_atm
)
head
,
while
(
!
gpr_atm_rel_cas
(
&
lock
->
head
,
(
gpr_atm
)
head
,
(
gpr_atm
)
&
lock
->
tombstone
))
{
(
gpr_atm
)
&
lock
->
tombstone
))
{
...
@@ -117,7 +124,7 @@ retry_top:
...
@@ -117,7 +124,7 @@ retry_top:
}
else
{
}
else
{
n
->
arg
=
arg
;
n
->
arg
=
arg
;
}
}
gpr_atm_
no_barrier
_store
(
&
n
->
next
,
0
);
gpr_atm_
rel
_store
(
&
n
->
next
,
0
);
while
(
!
gpr_atm_rel_cas
(
&
lock
->
head
,
head
,
(
gpr_atm
)
n
))
{
while
(
!
gpr_atm_rel_cas
(
&
lock
->
head
,
head
,
(
gpr_atm
)
n
))
{
retry_queue_load:
retry_queue_load:
head
=
gpr_atm_acq_load
(
&
lock
->
head
);
head
=
gpr_atm_acq_load
(
&
lock
->
head
);
...
@@ -132,5 +139,6 @@ retry_top:
...
@@ -132,5 +139,6 @@ retry_top:
return
;
// early out
return
;
// early out
}
}
}
}
gpr_atm_rel_store
(
&
((
grpc_aelock_qnode
*
)
head
)
->
next
,
(
gpr_atm
)
n
);
GPR_ASSERT
(
gpr_atm_rel_cas
(
&
((
grpc_aelock_qnode
*
)
head
)
->
next
,
0
,
(
gpr_atm
)
n
));
// gpr_atm_rel_store(&((grpc_aelock_qnode *)head)->next, (gpr_atm)n);
}
}
This diff is collapsed.
Click to expand it.
test/core/iomgr/async_execution_lock_test.c
+
1
−
1
View file @
dfbb1c08
...
@@ -87,7 +87,7 @@ static void execute_many_loop(void *a) {
...
@@ -87,7 +87,7 @@ static void execute_many_loop(void *a) {
grpc_exec_ctx
exec_ctx
=
GRPC_EXEC_CTX_INIT
;
grpc_exec_ctx
exec_ctx
=
GRPC_EXEC_CTX_INIT
;
size_t
n
=
1
;
size_t
n
=
1
;
for
(
size_t
i
=
0
;
i
<
10
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
10
;
i
++
)
{
for
(
size_t
j
=
0
;
j
<
1000
;
j
++
)
{
for
(
size_t
j
=
0
;
j
<
1000
0
;
j
++
)
{
ex_args
c
=
{
&
args
->
ctr
,
n
++
};
ex_args
c
=
{
&
args
->
ctr
,
n
++
};
grpc_aelock_execute
(
&
exec_ctx
,
args
->
lock
,
check_one
,
&
c
,
sizeof
(
c
));
grpc_aelock_execute
(
&
exec_ctx
,
args
->
lock
,
check_one
,
&
c
,
sizeof
(
c
));
grpc_exec_ctx_flush
(
&
exec_ctx
);
grpc_exec_ctx_flush
(
&
exec_ctx
);
...
...
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