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 9274ed4 commit 2b6d511
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 2b6d511

Please sign in to comment.