// File: guoxuanhan[P]NetServer/eventloop.cpp
// Function: EventLoop::EventLoop()
EventLoop::EventLoop() :
    functorlist_(), channellist_(), activechannellist_(), poller_(),
    quit_(true), tid_(std::this_thread::get_id()), mutex_(),
    wakeupfd_(CreateEventFd()), wakeupchannel_()
{
    wakeupchannel_.SetFd(wakeupfd_);
    wakeupchannel_.SetEvents(EPOLLIN | EPOLLET);
    wakeupchannel_.SetReadHandle(std::bind(&EventLoop::HandleRead, this));
    wakeupchannel_.SetErrorHandle(std::bind(&EventLoop::HandleError, this));
    AddChannelToPoller(&wakeupchannel_);
}

// Assembly:
subq $0x128, %rsp            # imm = 0x128
movq %rdi, 0x120(%rsp)
movq 0x120(%rsp), %rdi
movq %rdi, 0x60(%rsp)
movq %rdi, %rax
movq %rax, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
callq 0x8920
movaps 0x40(%rsp), %xmm0
movq 0x60(%rsp), %rax
movq %rax, %rdi
addq $0x18, %rdi
movq %rdi, 0x38(%rsp)
movups %xmm0, 0x18(%rax)
movq $0x0, 0x28(%rax)
callq 0x8930
movaps 0x40(%rsp), %xmm0
movq 0x60(%rsp), %rax
movq %rax, %rdi
addq $0x30, %rdi
movq %rdi, 0x58(%rsp)
movups %xmm0, 0x30(%rax)
movq $0x0, 0x40(%rax)
callq 0x8930
movq 0x60(%rsp), %rdi
addq $0x48, %rdi
movq %rdi, 0x68(%rsp)
callq 0x181f0
jmp 0x819f
movq 0x30(%rsp), %rax
movb $0x1, 0xc0(%rax)
callq 0x8940
movq %rax, %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0xc8(%rax)
movq %rax, %rdi
addq $0xd0, %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0xe0(%rax)
movups %xmm0, 0xd0(%rax)
movq $0x0, 0xf0(%rax)
callq 0x8970
movq 0x30(%rsp), %rax
addq $0xf8, %rax
movq %rax, 0x20(%rsp)
callq 0x80b0
movl %eax, 0x2c(%rsp)
jmp 0x8205
movq 0x30(%rsp), %rdi
movq 0x20(%rsp), %rax
movl 0x2c(%rsp), %ecx
movl %ecx, (%rax)
addq $0x100, %rdi            # imm = 0x100
movq %rdi, 0x18(%rsp)
callq 0x5bc0
jmp 0x8228
movq 0x30(%rsp), %rax
movq %rax, %rdi
addq $0x100, %rdi            # imm = 0x100
movl 0xf8(%rax), %esi
callq 0x5c70
jmp 0x8244
movq 0x30(%rsp), %rdi
addq $0x100, %rdi            # imm = 0x100
movl $0x80000001, %esi       # imm = 0x80000001
callq 0x5ca0
jmp 0x825c
movq 0x30(%rsp), %rax
movq %rax, %rcx
addq $0x100, %rcx            # imm = 0x100
movq %rcx, 0x10(%rsp)
leaq 0x1e9(%rip), %rcx       # 0x8460
movq %rcx, 0xc8(%rsp)
movq $0x0, 0xd0(%rsp)
movq %rax, 0xc0(%rsp)
leaq 0xd8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
callq 0x8980
jmp 0x82b2
leaq 0xf0(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x89c0
jmp 0x82c9
movq 0x10(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x5df0
jmp 0x82dd
leaq 0xf0(%rsp), %rdi
callq 0x5ef0
movq 0x30(%rsp), %rax
movq %rax, %rcx
addq $0x100, %rcx            # imm = 0x100
movq %rcx, 0x8(%rsp)
leaq 0x19b(%rip), %rcx       # 0x84a0
movq %rcx, 0x78(%rsp)
movq $0x0, 0x80(%rsp)
movq %rax, 0x70(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x78(%rsp), %rsi
leaq 0x70(%rsp), %rdx
callq 0x8980
jmp 0x8334
leaq 0xa0(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x89c0
jmp 0x834b
movq 0x8(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x5e50
jmp 0x835f
leaq 0xa0(%rsp), %rdi
callq 0x5ef0
movq 0x30(%rsp), %rdi
movq %rdi, %rsi
addq $0x100, %rsi            # imm = 0x100
callq 0x84b0
jmp 0x8382
addq $0x128, %rsp            # imm = 0x128
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
jmp 0x8427
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
jmp 0x841d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
jmp 0x8413
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x5ef0
jmp 0x8413
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x5ef0
movq 0x18(%rsp), %rdi
callq 0x5c20
movq 0x68(%rsp), %rdi
callq 0x18350
movq 0x58(%rsp), %rdi
callq 0x8a70
movq 0x38(%rsp), %rdi
callq 0x8a70
movq 0x60(%rsp), %rdi
callq 0x8ad0
movq 0x118(%rsp), %rdi
callq 0x5660
nopw %cs:(%rax,%rax)