// // Created by anton on 6/24/22. // #include "global_thread_pool.h" namespace pmp::core { // public frame_id_t global_thread_pool::insert_frame(void *argument, void *scope, call_frame_target *target_function, frame_id_t parent) { assert(("ThreadPool must be active when inserting! stop() or join() were called too early!", m_active)); frame_id_t id = m_last_id++; return id; } void global_thread_pool::join() { assert(m_active); stop(); std::cout << "joining..." << std::endl; for (size_t i = 0; i < m_thread_count; i++) { if (m_threads[i].joinable()) { m_threads[i].join(); std::cout << "thread " << i << " joined!" << std::endl; } else { std::cout << "thread " << i << " not joinable" << std::endl; } } std::cout << "done!" << std::endl; std::cout << "GlobalThreadPool finished!" << std::endl; } // private void global_thread_pool::worker() { // std::cout << "Hello from worker #" << std::this_thread::get_id() << std::endl; using namespace std::chrono_literals; call_frame* current = m_root_frame; while (true) { break; if (!current->evaluate()) { // someone else was faster } } } }