Skip to content

Commit

Permalink
When threadpool size is 0, using photon::thread_create directly
Browse files Browse the repository at this point in the history
Signed-off-by: Coldwings <coldwings@me.com>
  • Loading branch information
Coldwings committed Jan 9, 2024
1 parent 204e9cc commit 00547b3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions thread/thread-pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace photon

TPControl* ThreadPoolBase::thread_create_ex(thread_entry start, void* arg, bool joinable)
{
if (__should_bypass_threadpool()) {
if (m_capacity == 0 || __should_bypass_threadpool()) {
auto th = photon::thread_create(start, arg, (uint64_t)m_reserved,
sizeof(TPControl));
auto pCtrl = photon::thread_reserved_space<TPControl>(th);
Expand Down Expand Up @@ -129,7 +129,7 @@ namespace photon
}
void ThreadPoolBase::join(TPControl* pCtrl)
{
if (__should_bypass_threadpool()) {
if (m_capacity == 0 || __should_bypass_threadpool()) {
photon::thread_join((photon::join_handle*)pCtrl->th);
return;
}
Expand Down

0 comments on commit 00547b3

Please sign in to comment.