Skip to content

Commit

Permalink
Merge pull request #38 from Gooddbird/mn_coroutine
Browse files Browse the repository at this point in the history
fix test_coroutine core
  • Loading branch information
Gooddbird authored Aug 20, 2022
2 parents ef61f70 + 47c3680 commit 9b646f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions testcases/test_coroutine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ void* thread1_func(void*) {
}

void* thread2_func(void*) {
tinyrpc::Coroutine::GetCurrentCoroutine();
std::cout << "thread 2 begin" << std::endl;
std::cout << "now begin to resume fun1 coroutine in thread 2" << std::endl;
tinyrpc::Coroutine::Resume(cor.get());
Expand Down
8 changes: 4 additions & 4 deletions tinyrpc/coroutine/coroutine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Coroutine::Coroutine() {
t_coroutine_count++;
memset(&m_coctx, 0, sizeof(m_coctx));
t_cur_coroutine = this;
DebugLog << "coroutine[" << m_cor_id << "] create";
// DebugLog << "coroutine[" << m_cor_id << "] create";
}

Coroutine::Coroutine(int size, char* stack_ptr) : m_stack_size(size), m_stack_sp(stack_ptr) {
Expand All @@ -75,7 +75,7 @@ Coroutine::Coroutine(int size, char* stack_ptr) : m_stack_size(size), m_stack_sp

m_cor_id = t_cur_coroutine_id++;
t_coroutine_count++;
DebugLog << "coroutine[" << m_cor_id << "] create";
// DebugLog << "coroutine[" << m_cor_id << "] create";
}

Coroutine::Coroutine(int size, char* stack_ptr, std::function<void()> cb)
Expand All @@ -90,7 +90,7 @@ Coroutine::Coroutine(int size, char* stack_ptr, std::function<void()> cb)
setCallBack(cb);
m_cor_id = t_cur_coroutine_id++;
t_coroutine_count++;
DebugLog << "coroutine[" << m_cor_id << "] create";
// DebugLog << "coroutine[" << m_cor_id << "] create";
}

bool Coroutine::setCallBack(std::function<void()> cb) {
Expand Down Expand Up @@ -129,7 +129,7 @@ bool Coroutine::setCallBack(std::function<void()> cb) {

Coroutine::~Coroutine() {
t_coroutine_count--;
DebugLog << "coroutine[" << m_cor_id << "] die";
// DebugLog << "coroutine[" << m_cor_id << "] die";
}

Coroutine* Coroutine::GetCurrentCoroutine() {
Expand Down

0 comments on commit 9b646f0

Please sign in to comment.