Skip to content

Commit 508bc20

Browse files
committed
tpool - misc fixes
1 parent c27577a commit 508bc20

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

tpool/tpool_generic.cc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -742,17 +742,14 @@ void thread_pool_generic::submit_task(task* task)
742742
/* Notify thread pool that current thread is going to wait */
743743
void thread_pool_generic::wait_begin()
744744
{
745-
if (!tls_worker_data || tls_worker_data->is_long_task() || tls_worker_data->is_waiting())
745+
if (!tls_worker_data || tls_worker_data->is_long_task())
746746
return;
747747
std::unique_lock<std::mutex> lk(m_mtx);
748748
tls_worker_data->m_state |= worker_data::WAITING;
749749
m_waiting_task_count++;
750750

751751
/* Maintain concurrency */
752-
if (m_task_queue.empty())
753-
return;
754-
if (m_active_threads.size() - m_long_tasks_count - m_waiting_task_count < m_concurrency)
755-
maybe_wake_or_create_thread();
752+
maybe_wake_or_create_thread();
756753
}
757754

758755

tpool/wait_notification.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include <tpool.h>
22

3+
namespace tpool
4+
{
35
static thread_local tpool::thread_pool* tls_thread_pool;
46

57
extern "C" void set_tls_pool(tpool::thread_pool* pool)
@@ -18,4 +20,6 @@ extern "C" void tpool_wait_end()
1820
{
1921
if (tls_thread_pool)
2022
tls_thread_pool->wait_end();
21-
}
23+
}
24+
25+
}

0 commit comments

Comments
 (0)