// File: yangwanyuan[P]HLKVDS/src/Tier.cc
// Function: hlkvds::FastTier::SegTimeoutThdEntry()
void FastTier::SegTimeoutThdEntry() {
    __DEBUG("Segment Timeout thread start!!");
    std::unique_lock<std::mutex> lck_seg_map(segMapMtx_, std::defer_lock);

    while (!segTimeoutT_stop_) {
        for ( int i = 0; i < shardsNum_; i++) {
            std::mutex *mtx = segMtxVec_[i];
            std::unique_lock<std::mutex> l(*mtx);

            lck_seg_map.lock();
            SegForReq *seg = segMap_[i];
            lck_seg_map.unlock();

            if (seg->IsExpired()) {
                seg->Completion();

                segWteWQ_->Add_task(seg);
                seg = new SegForReq(vol_, idxMgr_, options_.expired_time);

                lck_seg_map.lock();
                std::map<int, SegForReq*>::iterator iter = segMap_.find(i);
                segMap_.erase(iter);
                segMap_.insert( make_pair(i, seg) );
                lck_seg_map.unlock();
            }
        }

        usleep(options_.expired_time);
    } __DEBUG("Segment Timeout thread stop!!");
}

// Assembly:
subq $0xe8, %rsp
movq %rdi, 0xe0(%rsp)
movq 0xe0(%rsp), %rsi
movq %rsi, 0x58(%rsp)
addq $0x128, %rsi            # imm = 0x128
leaq 0xd0(%rsp), %rdi
callq 0x16db0
movq 0x58(%rsp), %rdi
addq $0x218, %rdi            # imm = 0x218
callq 0x16f80
xorb $-0x1, %al
testb $0x1, %al
jne 0x4a29c
jmp 0x4a562
movl $0x0, 0xc8(%rsp)
movq 0x58(%rsp), %rcx
movl 0xc8(%rsp), %eax
cmpl 0x124(%rcx), %eax
jge 0x4a54b
movq 0x58(%rsp), %rdi
addq $0x180, %rdi            # imm = 0x180
movslq 0xc8(%rsp), %rsi
callq 0x16d00
movq (%rax), %rax
movq %rax, 0xc0(%rsp)
movq 0xc0(%rsp), %rsi
leaq 0xb0(%rsp), %rdi
callq 0x15a10
jmp 0x4a2fa
leaq 0xd0(%rsp), %rdi
callq 0x16dd0
jmp 0x4a309
movq 0x58(%rsp), %rdi
addq $0x150, %rdi            # imm = 0x150
leaq 0xc8(%rsp), %rsi
callq 0x16c10
movq %rax, 0x50(%rsp)
jmp 0x4a329
movq 0x50(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x98(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x16e30
jmp 0x4a348
movq 0x98(%rsp), %rdi
callq 0x43030
movb %al, 0x4f(%rsp)
jmp 0x4a35b
movb 0x4f(%rsp), %al
testb $0x1, %al
jne 0x4a368
jmp 0x4a519
movq 0x98(%rsp), %rdi
callq 0x42ce0
jmp 0x4a377
movq 0x58(%rsp), %rax
movq 0x208(%rax), %rdi
movq 0x98(%rsp), %rsi
callq 0x16e80
jmp 0x4a392
movl $0xd8, %edi
callq 0x84f0
movq %rax, 0x40(%rsp)
jmp 0x4a3a3
movq 0x40(%rsp), %rdi
movq 0x58(%rsp), %rcx
movq 0x1d8(%rcx), %rsi
movq (%rcx), %rax
movq 0x10(%rcx), %rdx
movl 0x10(%rax), %ecx
callq 0x42b00
jmp 0x4a3c5
movq 0x40(%rsp), %rax
movq %rax, 0x98(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x16dd0
jmp 0x4a3e1
movq 0x58(%rsp), %rdi
addq $0x150, %rdi            # imm = 0x150
leaq 0xc8(%rsp), %rsi
callq 0x16f00
movq %rax, 0x38(%rsp)
jmp 0x4a401
movq 0x58(%rsp), %rdi
movq 0x38(%rsp), %rax
movq %rax, 0x90(%rsp)
addq $0x150, %rdi            # imm = 0x150
movq 0x90(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x88(%rsp), %rsi
callq 0x16f30
movq %rax, 0x30(%rsp)
jmp 0x4a43e
movq 0x58(%rsp), %rax
movq 0x30(%rsp), %rcx
movq %rcx, 0x80(%rsp)
addq $0x150, %rax            # imm = 0x150
movq %rax, 0x18(%rsp)
leaq 0xc8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x15b90
movq %rdx, 0x20(%rsp)
movl %eax, 0x2c(%rsp)
jmp 0x4a47b
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rax
movl 0x2c(%rsp), %ecx
movl %ecx, 0x70(%rsp)
movq %rax, 0x78(%rsp)
leaq 0x70(%rsp), %rsi
callq 0x15b40
movb %dl, 0xf(%rsp)
movq %rax, 0x10(%rsp)
jmp 0x4a4a7
movb 0xf(%rsp), %al
movq 0x10(%rsp), %rcx
movq %rcx, 0x60(%rsp)
movb %al, 0x68(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x16e30
jmp 0x4a4c8
jmp 0x4a519
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa8(%rsp)
movl %eax, 0xa4(%rsp)
jmp 0x4a577
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa8(%rsp)
movl %eax, 0xa4(%rsp)
jmp 0x4a53c
movq 0x40(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa8(%rsp)
movl %eax, 0xa4(%rsp)
callq 0x84b0
jmp 0x4a53c
leaq 0xb0(%rsp), %rdi
callq 0x15c30
movl 0xc8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc8(%rsp)
jmp 0x4a2a7
leaq 0xb0(%rsp), %rdi
callq 0x15c30
jmp 0x4a577
movq 0x58(%rsp), %rax
movq (%rax), %rax
movl 0x10(%rax), %edi
callq 0x86e0
jmp 0x4a55d
jmp 0x4a280
leaq 0xd0(%rsp), %rdi
callq 0x15c30
addq $0xe8, %rsp
retq
leaq 0xd0(%rsp), %rdi
callq 0x15c30
movq 0xa8(%rsp), %rdi
callq 0x8820
nopw %cs:(%rax,%rax)