Skip to content

Commit

Permalink
framework: Add protect for croutine
Browse files Browse the repository at this point in the history
  • Loading branch information
GoLancer authored and Jiangtao Hu committed Dec 13, 2018
1 parent 623a5c7 commit 8a72146
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cyber/croutine/croutine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ CRoutine::CRoutine(const std::function<void()> &func) : func_(func) {
context_pool.reset(new base::CCObjectPool<RoutineContext>(routine_num));
}
context_ = context_pool->GetObject();
CHECK_NOTNULL(context_);
if (context_ == nullptr) {
context_.reset(new RoutineContext());
}
MakeContext(CRoutineEntry, this, context_.get());
state_ = RoutineState::READY;
updated_.test_and_set(std::memory_order_release);
Expand Down

0 comments on commit 8a72146

Please sign in to comment.