- methods to expand tilda in file pathes + methods to control thread pool

This commit is contained in:
2024-05-16 08:42:55 +03:00
parent 05e3cc8cb6
commit 62f2d996c6
4 changed files with 46 additions and 4 deletions

View File

@@ -20,6 +20,17 @@ void thread_pool::enqueue(const thread_pool::task& t)
this->condition.notify_one();
}
void thread_pool::wait(std::chrono::milliseconds interval)
{
while (size() != 0)
std::this_thread::sleep_for(interval);
}
size_t thread_pool::size()
{
std::unique_lock l(this->queue_mutex);
return this->tasks.size();
}
// the destructor joins all threads
thread_pool::~thread_pool()
@@ -37,7 +48,7 @@ void thread_pool::run_worker()
{
ThreadHelper::setName(this->name);
task t;
while(!this->stop)
while (!this->stop)
{
{
std::unique_lock<std::mutex> lock(this->queue_mutex);