// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/server.cpp
// Function: Loop::_check_timeout()
void Loop::_check_timeout() {
    if(!server->global_lock.try_lock()) return;

    u32 now = get_time_sec();
    for(const auto &ql : server->_queue_list) {
        if(!ql) continue;

        LOCK _l(ql->mutex);

        for(int i=0;i<server->threads;i++) {
            for(const auto &worker : ql->queue[i].workers) {
                if(!worker->ping) continue;
                if(worker->ping_timeout > now) continue;
                if(worker->is_closed()) continue;

                bool busy = true;
                if(worker->status == Status::worker_wait_job) {
                    worker->mutex.lock();
                    if(worker->status == Status::worker_wait_job) {
                        worker->status = Status::busy;
                        busy = false;
                    }
                    worker->mutex.unlock();
                }
                if(busy) continue;

                if(worker->worker_mode) worker->status = Status::worker_mode_async;
                else worker->status = Status::net;
                worker->send.status("408 Timeout")->done();
                worker->ping_timeout = now + worker->ping;
                if(server->log & 8) std::cout << ltime() << "408 Timeout\n";
            }
        }
    }
    server->global_lock.unlock();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %r14
movl $0x20058, %edi          # imm = 0x20058
addq 0x18(%r14), %rdi
callq 0x80a0
testl %eax, %eax
je 0x10641
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x163d5
movl %eax, -0x2c(%rbp)
movq 0x18(%r14), %rdi
movq 0x20110(%rdi), %r12
movq 0x20118(%rdi), %rax
movq %rax, -0x48(%rbp)
cmpq %rax, %r12
je 0x10858
movq %r14, -0x40(%rbp)
movq (%r12), %rdi
testq %rdi, %rdi
je 0x10846
addq $0x18, %rdi
movq %rdi, -0x38(%rbp)
callq 0x83f0
testl %eax, %eax
jne 0x10879
movq 0x18(%r14), %rax
cmpl $0x0, 0x28(%rax)
jle 0x1083d
xorl %esi, %esi
movq %r12, -0x50(%rbp)
movq (%r12), %rcx
movq 0x40(%rcx), %rcx
leaq (%rsi,%rsi,4), %rdx
shlq $0x5, %rdx
movq 0x10(%rcx,%rdx), %r15
movq 0x30(%rcx,%rdx), %rbx
cmpq %rbx, %r15
je 0x1082d
movq %rsi, -0x58(%rbp)
addq %rdx, %rcx
movq 0x20(%rcx), %r14
movq 0x28(%rcx), %r13
movq (%r15), %rdi
cmpl $0x0, 0xf8(%rdi)
je 0x107fc
movl -0x2c(%rbp), %eax
cmpl %eax, 0xfc(%rdi)
ja 0x107fc
cmpl $-0x1, (%rdi)
je 0x107fc
cmpl $0x1, 0xcc(%rdi)
jne 0x107fc
addq $0x50, %rdi
callq 0x83f0
testl %eax, %eax
jne 0x10872
movq (%r15), %rdi
cmpl $0x1, 0xcc(%rdi)
jne 0x107bb
movl $0x5, 0xcc(%rdi)
addq $0x50, %rdi
callq 0x8240
movq (%r15), %rdi
cmpb $0x0, 0xf3(%rdi)
movl $0x0, %eax
movl $0x6, %ecx
cmovnel %ecx, %eax
movl %eax, 0xcc(%rdi)
addq $0x18, %rdi
leaq 0x7d11(%rip), %rsi      # 0x18476
callq 0x9ec6
movq %rax, %rdi
callq 0xa864
movq (%r15), %rax
movl 0xf8(%rax), %ecx
addl -0x2c(%rbp), %ecx
movl %ecx, 0xfc(%rax)
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
testb $0x8, 0x20(%rax)
je 0x107fc
callq 0x163f5
movq %rax, %r12
testq %rax, %rax
je 0x107c6
movq %r12, %rdi
callq 0x8130
movq 0xd822(%rip), %rdi      # 0x1dfd0
movq %r12, %rsi
movq %rax, %rdx
callq 0x8350
jmp 0x107e4
addq $0x50, %rdi
callq 0x8240
jmp 0x107fc
movq 0xd803(%rip), %rcx      # 0x1dfd0
movq (%rcx), %rax
movq -0x18(%rax), %rax
leaq (%rcx,%rax), %rdi
movl 0x20(%rcx,%rax), %esi
orl $0x1, %esi
callq 0x8470
movl $0xc, %edx
movq 0xd7e0(%rip), %rdi      # 0x1dfd0
leaq 0x7c8b(%rip), %rsi      # 0x18482
callq 0x8350
addq $0x8, %r15
cmpq %r14, %r15
jne 0x10814
movq 0x8(%r13), %r15
addq $0x8, %r13
leaq 0x200(%r15), %r14
cmpq %rbx, %r15
jne 0x106d4
movq -0x40(%rbp), %r14
movq 0x18(%r14), %rax
movq -0x50(%rbp), %r12
movq -0x58(%rbp), %rsi
incq %rsi
movslq 0x28(%rax), %rcx
cmpq %rcx, %rsi
jl 0x106a2
movq -0x38(%rbp), %rdi
callq 0x8240
addq $0x8, %r12
cmpq -0x48(%rbp), %r12
jne 0x1066c
movq 0x18(%r14), %rdi
addq $0x20058, %rdi          # imm = 0x20058
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8240
movl %eax, %edi
callq 0x81d0
movl %eax, %edi
callq 0x81d0
jmp 0x10882
movq %rax, %rbx
movq -0x38(%rbp), %rdi
callq 0x8240
movq %rbx, %rdi
callq 0x84a0