// File: white0dew[P]WebServer/././threadpool/threadpool.h
// Function: threadpool<http_conn>::run()
void threadpool<T>::run()
{
    while (true)
    {
        m_queuestat.wait();
        m_queuelocker.lock();
        if (m_workqueue.empty())
        {
            m_queuelocker.unlock();
            continue;
        }
        //
        T *request = m_workqueue.front();
        m_workqueue.pop_front();
        m_queuelocker.unlock();
        if (!request)
            continue;
        //Reactor
        if (1 == m_actor_model)
        {
            //IO事件类型：0为读
            if (0 == request->m_state)
            {
                if (request->read_once())
                {
                    request->improv = 1;
                    connectionRAII mysqlcon(&request->mysql, m_connPool);
                    request->process();
                }
                else
                {
                    request->improv = 1;
                    request->timer_flag = 1;
                }
            }
            else
            {
                if (request->write())
                {
                    request->improv = 1;
                }
                else
                {
                    request->improv = 1;
                    request->timer_flag = 1;
                }
            }
        }
        //default:Proactor，线程池不需要进行数据读取，而是直接开始业务处理
        //之前的操作已经将数据读取到http的read和write的buffer中了
        else
        {
            connectionRAII mysqlcon(&request->mysql, m_connPool);
            request->process();
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
addq $0x50, %rdi
callq 0xa580
movq -0x48(%rbp), %rdi
addq $0x28, %rdi
callq 0x6f90
movq -0x48(%rbp), %rdi
addq $0x10, %rdi
callq 0xd150
testb $0x1, %al
jne 0xcfe1
jmp 0xcff0
movq -0x48(%rbp), %rdi
addq $0x28, %rdi
callq 0x7110
jmp 0xcfb4
movq -0x48(%rbp), %rdi
addq $0x10, %rdi
callq 0xd170
movq -0x48(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x10(%rbp)
addq $0x10, %rdi
callq 0xd1a0
movq -0x48(%rbp), %rdi
addq $0x28, %rdi
callq 0x7110
cmpq $0x0, -0x10(%rbp)
jne 0xd027
jmp 0xcfb4
movq -0x48(%rbp), %rcx
movl $0x1, %eax
cmpl 0x78(%rcx), %eax
jne 0xd0f3
movq -0x10(%rbp), %rcx
xorl %eax, %eax
cmpl 0x10(%rcx), %eax
jne 0xd0be
movq -0x10(%rbp), %rdi
callq 0x51c0
testb $0x1, %al
jne 0xd053
jmp 0xd0a7
movq -0x48(%rbp), %rax
movq -0x10(%rbp), %rcx
movl $0x1, 0x4(%rcx)
movq -0x10(%rbp), %rsi
addq $0x8, %rsi
movq 0x70(%rax), %rdx
leaq -0x20(%rbp), %rdi
callq 0xa370
movq -0x10(%rbp), %rdi
callq 0x6c20
jmp 0xd082
leaq -0x20(%rbp), %rdi
callq 0xa3c0
jmp 0xd0bc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x20(%rbp), %rdi
callq 0xa3c0
jmp 0xd13e
movq -0x10(%rbp), %rax
movl $0x1, 0x4(%rax)
movq -0x10(%rbp), %rax
movl $0x1, (%rax)
jmp 0xd0f1
movq -0x10(%rbp), %rdi
callq 0x64e0
testb $0x1, %al
jne 0xd0cd
jmp 0xd0da
movq -0x10(%rbp), %rax
movl $0x1, 0x4(%rax)
jmp 0xd0ef
movq -0x10(%rbp), %rax
movl $0x1, 0x4(%rax)
movq -0x10(%rbp), %rax
movl $0x1, (%rax)
jmp 0xd0f1
jmp 0xd139
movq -0x48(%rbp), %rax
movq -0x10(%rbp), %rsi
addq $0x8, %rsi
movq 0x70(%rax), %rdx
leaq -0x40(%rbp), %rdi
callq 0xa370
movq -0x10(%rbp), %rdi
callq 0x6c20
jmp 0xd117
leaq -0x40(%rbp), %rdi
callq 0xa3c0
jmp 0xd139
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0xa3c0
jmp 0xd13e
jmp 0xcfb4
movq -0x28(%rbp), %rdi
callq 0x3710
nopw (%rax,%rax)