Create a pool of new worker threads.
| 141 | |
| 142 | //! Create a pool of new worker threads. |
| 143 | void StartWorkerThreads(const int threads_num) |
| 144 | { |
| 145 | { |
| 146 | LOCK(m_mutex); |
| 147 | nIdle = 0; |
| 148 | nTotal = 0; |
| 149 | fAllOk = true; |
| 150 | } |
| 151 | assert(m_worker_threads.empty()); |
| 152 | for (int n = 0; n < threads_num; ++n) { |
| 153 | m_worker_threads.emplace_back([this, n]() { |
| 154 | util::ThreadRename(strprintf("scriptch.%i", n)); |
| 155 | SetSyscallSandboxPolicy(SyscallSandboxPolicy::VALIDATION_SCRIPT_CHECK); |
| 156 | Loop(false /* worker thread */); |
| 157 | }); |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | //! Wait until execution finishes, and return whether all evaluations were successful. |
| 162 | bool Wait() |