Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
f0f4a4e5
Commit
f0f4a4e5
authored
Sep 06, 2017
by
chenzhangyi01
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cherry pick from svn r35222
Change-Id: Id0ffe967ffba5097536892f75ba7eb2c42a952b9
parent
c9627fc4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
7 deletions
+8
-7
butex.cpp
src/bthread/butex.cpp
+1
-1
parking_lot.h
src/bthread/parking_lot.h
+7
-3
task_group.cpp
src/bthread/task_group.cpp
+0
-3
No files found.
src/bthread/butex.cpp
View file @
f0f4a4e5
...
...
@@ -653,7 +653,7 @@ int butex_wait(void* arg, int expected_value, const timespec* abstime) {
}
}
#ifdef SHOW_BTHREAD_BUTEX_WAITER_COUNT_IN_VARS
bvar
::
Adder
<
int64_t
>
*
num_waiters
=
*
butex_waiter_count
();
bvar
::
Adder
<
int64_t
>
&
num_waiters
=
butex_waiter_count
();
num_waiters
<<
1
;
#endif
...
...
src/bthread/parking_lot.h
View file @
f0f4a4e5
...
...
@@ -27,8 +27,13 @@ namespace bthread {
// Park idle workers.
class
BAIDU_CACHELINE_ALIGNMENT
ParkingLot
{
public
:
struct
State
{
class
State
{
public
:
State
()
:
val
(
0
)
{}
bool
stopped
()
const
{
return
val
&
1
;
}
private
:
friend
class
ParkingLot
;
State
(
int
val
)
:
val
(
val
)
{}
int
val
;
};
...
...
@@ -43,8 +48,7 @@ public:
// Get a state for later wait().
State
get_state
()
{
const
State
st
=
{
_pending_signal
.
load
(
base
::
memory_order_acquire
)};
return
st
;
return
_pending_signal
.
load
(
base
::
memory_order_acquire
);
}
// Wait for tasks.
...
...
src/bthread/task_group.cpp
View file @
f0f4a4e5
...
...
@@ -174,9 +174,6 @@ void TaskGroup::run_main_task() {
TaskGroup
*
dummy
=
this
;
bthread_t
tid
;
#ifndef BTHREAD_DONT_SAVE_PARKING_STATE
_last_pl_state
=
_pl
->
get_state
();
#endif
while
(
wait_task
(
&
tid
))
{
TaskGroup
::
sched_to
(
&
dummy
,
tid
);
DCHECK_EQ
(
this
,
dummy
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment