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
e2980cd0
Commit
e2980cd0
authored
9 years ago
by
Vijay Pai
Browse files
Options
Downloads
Patches
Plain Diff
Eliminate data-race caused by specialization in vector<bool>
parent
23ca82ab
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/cpp/qps/client_async.cc
+11
-2
11 additions, 2 deletions
test/cpp/qps/client_async.cc
with
11 additions
and
2 deletions
test/cpp/qps/client_async.cc
+
11
−
2
View file @
e2980cd0
...
@@ -168,7 +168,7 @@ class AsyncClient : public Client {
...
@@ -168,7 +168,7 @@ class AsyncClient : public Client {
if
(
!
closed_loop_
)
{
if
(
!
closed_loop_
)
{
rpc_deadlines_
.
emplace_back
();
rpc_deadlines_
.
emplace_back
();
next_channel_
.
push_back
(
i
%
channel_count_
);
next_channel_
.
push_back
(
i
%
channel_count_
);
issue_allowed_
.
push
_back
(
true
);
issue_allowed_
.
emplace
_back
(
true
);
grpc_time
next_issue
;
grpc_time
next_issue
;
NextIssueTime
(
i
,
&
next_issue
);
NextIssueTime
(
i
,
&
next_issue
);
...
@@ -307,11 +307,20 @@ class AsyncClient : public Client {
...
@@ -307,11 +307,20 @@ class AsyncClient : public Client {
}
}
private
:
private
:
class
boolean
{
// exists only to avoid data-race on vector<bool>
public:
boolean
()
:
val_
(
false
)
{}
boolean
(
bool
b
)
:
val_
(
b
)
{}
operator
bool
()
const
{
return
val_
;}
boolean
&
operator
=
(
bool
b
)
{
val_
=
b
;
return
*
this
;}
private
:
bool
val_
;
};
std
::
vector
<
std
::
unique_ptr
<
CompletionQueue
>>
cli_cqs_
;
std
::
vector
<
std
::
unique_ptr
<
CompletionQueue
>>
cli_cqs_
;
std
::
vector
<
deadline_list
>
rpc_deadlines_
;
// per thread deadlines
std
::
vector
<
deadline_list
>
rpc_deadlines_
;
// per thread deadlines
std
::
vector
<
int
>
next_channel_
;
// per thread round-robin channel ctr
std
::
vector
<
int
>
next_channel_
;
// per thread round-robin channel ctr
std
::
vector
<
bool
>
issue_allowed_
;
// may this thread attempt to issue
std
::
vector
<
bool
ean
>
issue_allowed_
;
// may this thread attempt to issue
std
::
vector
<
grpc_time
>
next_issue_
;
// when should it issue?
std
::
vector
<
grpc_time
>
next_issue_
;
// when should it issue?
std
::
vector
<
std
::
mutex
>
channel_lock_
;
std
::
vector
<
std
::
mutex
>
channel_lock_
;
...
...
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