| 102 | } |
| 103 | |
| 104 | void worker_thread_executor::enqueue_foreign(concurrencpp::task& task) { |
| 105 | std::unique_lock<std::mutex> lock(m_lock); |
| 106 | if (m_abort) { |
| 107 | details::throw_runtime_shutdown_exception(name); |
| 108 | } |
| 109 | |
| 110 | const auto is_empty = m_public_queue.empty(); |
| 111 | m_public_queue.emplace_back(std::move(task)); |
| 112 | |
| 113 | if (!m_thread.joinable()) { |
| 114 | return make_os_worker_thread(); |
| 115 | } |
| 116 | |
| 117 | lock.unlock(); |
| 118 | |
| 119 | if (is_empty) { |
| 120 | m_semaphore.release(); |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | void worker_thread_executor::enqueue_foreign(std::span<concurrencpp::task> tasks) { |
| 125 | std::unique_lock<std::mutex> lock(m_lock); |