Skip to content

Commit

Permalink
Add tips
Browse files Browse the repository at this point in the history
  • Loading branch information
ithewei committed Oct 26, 2022
1 parent 99f7fcf commit 4c20221
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions cpputil/hobjectpool.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef HV_OBJECT_POOL_H_
#define HV_OBJECT_POOL_H_

/*
* @usage unittest/objectpool_test.cpp
*/

#include <list>
#include <memory>
#include <mutex>
Expand Down
8 changes: 6 additions & 2 deletions cpputil/hthreadpool.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef HV_THREAD_POOL_H_
#define HV_THREAD_POOL_H_

/*
* @usage unittest/threadpool_test.cpp
*/

#include <time.h>
#include <thread>
#include <list>
Expand Down Expand Up @@ -104,8 +108,8 @@ class HThreadPool {
}

int wait() {
while (1) {
if (status == STOP || (tasks.empty() && idle_thread_num == cur_thread_num)) {
while (status != STOP) {
if (tasks.empty() && idle_thread_num == cur_thread_num) {
break;
}
std::this_thread::yield();
Expand Down

0 comments on commit 4c20221

Please sign in to comment.