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
4409f452
Unverified
Commit
4409f452
authored
Jan 30, 2019
by
Ge Jun
Committed by
GitHub
Jan 30, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #638 from eric-buaa-cn/master
bugfix to prevent accessing the reclaimed task
parents
8b74f72a
61b7959b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
timer_thread.cpp
src/bthread/timer_thread.cpp
+6
-2
No files found.
src/bthread/timer_thread.cpp
View file @
4409f452
...
...
@@ -348,12 +348,16 @@ void TimerThread::run() {
// Pull tasks from buckets.
for
(
size_t
i
=
0
;
i
<
_options
.
num_buckets
;
++
i
)
{
Bucket
&
bucket
=
_buckets
[
i
];
for
(
Task
*
p
=
bucket
.
consume_tasks
();
p
!=
NULL
;
p
=
p
->
next
,
++
nscheduled
)
{
for
(
Task
*
p
=
bucket
.
consume_tasks
();
p
!=
nullptr
;
++
nscheduled
)
{
// p->next should be kept first
// in case of the deletion of Task p which is unscheduled
Task
*
next_task
=
p
->
next
;
if
(
!
p
->
try_delete
())
{
// remove the task if it's unscheduled
tasks
.
push_back
(
p
);
std
::
push_heap
(
tasks
.
begin
(),
tasks
.
end
(),
task_greater
);
}
p
=
next_task
;
}
}
...
...
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