// File: wichtounet[P]cpp_utils_test/include/cpp_utils/thread_pool.hpp
// Function: cpp::default_thread_pool<std::deque>::default_thread_pool(unsigned long)
explicit default_thread_pool(std::size_t n) : status(n, thread_status::WAITING) {
        // The thread pool is of fixed size, avoid any possible reallocation
        threads.reserve(n);

        // Lets all the threads start at the same time and avoid any possible race conditions
        std::unique_lock<std::mutex> ulock(main_lock);

        for (std::size_t t = 0; t < n; ++t) {
            threads.emplace_back([this, t] {
                while (true) {
                    std::function<void()> task;

                    {
                        std::unique_lock<std::mutex> ulock(main_lock);

                        status[t] = thread_status::WAITING;

                        wait_condition.notify_one();

                        condition.wait(ulock, [this] {
                            return stop_flag || !tasks.empty();
                        });

                        if (stop_flag && tasks.empty()) {
                            return;
                        }

                        task = std::move(tasks.front());
                        tasks.pop_front();

                        status[t] = thread_status::WORKING;
                    }

                    task();
                }
            });
        }
    }

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x90(%rsp)
movq %rsi, 0x88(%rsp)
movq 0x90(%rsp), %rdi
movq %rdi, 0x28(%rsp)
movq %rdi, %rax
movq %rax, 0x20(%rsp)
callq 0x4daf0
movq 0x28(%rsp), %rax
addq $0x18, %rax
movq %rax, 0x30(%rsp)
movq 0x88(%rsp), %rax
movq %rax, 0x38(%rsp)
movl $0x0, 0x84(%rsp)
leaq 0x83(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x4db00
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rcx
leaq 0x84(%rsp), %rdx
callq 0x4db10
jmp 0x4d967
leaq 0x83(%rsp), %rdi
callq 0x4db90
movq 0x20(%rsp), %rdi
addq $0x30, %rdi
movq %rdi, 0x18(%rsp)
callq 0x4dba0
jmp 0x4d989
movq 0x20(%rsp), %rdi
subq $-0x80, %rdi
callq 0x4dbb0
movq 0x20(%rsp), %rdi
addq $0xa8, %rdi
movq %rdi, 0x8(%rsp)
callq 0xa6d0
movq 0x20(%rsp), %rdi
addq $0xd8, %rdi
movq %rdi, 0x10(%rsp)
callq 0xa6d0
movq 0x20(%rsp), %rdi
movb $0x0, 0x108(%rdi)
movq 0x88(%rsp), %rsi
callq 0x4dbc0
jmp 0x4d9de
movq 0x20(%rsp), %rsi
subq $-0x80, %rsi
leaq 0x60(%rsp), %rdi
callq 0x4dcd0
jmp 0x4d9f3
movq $0x0, 0x58(%rsp)
movq 0x58(%rsp), %rax
cmpq 0x88(%rsp), %rax
jae 0x4da98
movq 0x20(%rsp), %rdi
movq %rdi, 0x48(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x50(%rsp)
leaq 0x48(%rsp), %rsi
callq 0x4dd10
jmp 0x4da2f
jmp 0x4da31
movq 0x58(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x58(%rsp)
jmp 0x4d9fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
leaq 0x83(%rsp), %rdi
callq 0x4db90
jmp 0x4dad2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
jmp 0x4dac8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
jmp 0x4daaa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x4dd90
jmp 0x4daaa
leaq 0x60(%rsp), %rdi
callq 0x4dd90
addq $0x98, %rsp
retq
movq 0x10(%rsp), %rdi
callq 0xa8d0
movq 0x8(%rsp), %rdi
callq 0xa8d0
movq 0x18(%rsp), %rdi
callq 0x4ddd0
movq 0x30(%rsp), %rdi
callq 0x4de40
movq 0x28(%rsp), %rdi
callq 0x4dea0
movq 0x78(%rsp), %rdi
callq 0xa890
nopw %cs:(%rax,%rax)