// File: yangwanyuan[P]HLKVDS/src/DS_MultiVolume_Impl.cc
// Function: hlkvds::DS_MultiVolume_Impl::SegTimeoutThdEntry()
void DS_MultiVolume_Impl::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);
                int vol_id = pickVol();
                seg = new SegForReq(volMap_[vol_id], 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 $0xf8, %rsp
movq %rdi, 0xf0(%rsp)
movq 0xf0(%rsp), %rsi
movq %rsi, 0x60(%rsp)
addq $0x60, %rsi
leaq 0xe0(%rsp), %rdi
callq 0x16db0
movq 0x60(%rsp), %rdi
addq $0x168, %rdi            # imm = 0x168
callq 0x16f80
xorb $-0x1, %al
testb $0x1, %al
jne 0x12249
jmp 0x1254a
movl $0x0, 0xd8(%rsp)
movq 0x60(%rsp), %rcx
movl 0xd8(%rsp), %eax
cmpl 0x58(%rcx), %eax
jge 0x12532
movq 0x60(%rsp), %rdi
addq $0xb8, %rdi
movslq 0xd8(%rsp), %rsi
callq 0x16d00
movq (%rax), %rax
movq %rax, 0xd0(%rsp)
movq 0xd0(%rsp), %rsi
leaq 0xc0(%rsp), %rdi
callq 0x15a10
jmp 0x122a4
leaq 0xe0(%rsp), %rdi
callq 0x16dd0
jmp 0x122b3
movq 0x60(%rsp), %rdi
addq $0x88, %rdi
leaq 0xd8(%rsp), %rsi
callq 0x16c10
movq %rax, 0x58(%rsp)
jmp 0x122d3
movq 0x58(%rsp), %rax
movq (%rax), %rax
movq %rax, 0xa8(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x16e30
jmp 0x122f2
movq 0xa8(%rsp), %rdi
callq 0x43030
movb %al, 0x57(%rsp)
jmp 0x12305
movb 0x57(%rsp), %al
testb $0x1, %al
jne 0x12312
jmp 0x12500
movq 0xa8(%rsp), %rdi
callq 0x42ce0
jmp 0x12321
movq 0x60(%rsp), %rax
movq 0x158(%rax), %rdi
movq 0xa8(%rsp), %rsi
callq 0x16e80
jmp 0x1233c
movq 0x60(%rsp), %rdi
callq 0x11fa0
movl %eax, 0x50(%rsp)
jmp 0x1234c
movl 0x50(%rsp), %eax
movl %eax, 0xa4(%rsp)
movl $0xd8, %edi
callq 0x84f0
movq %rax, 0x48(%rsp)
jmp 0x12368
movq 0x60(%rsp), %rdi
addq $0x28, %rdi
leaq 0xa4(%rsp), %rsi
callq 0x15a50
movq %rax, 0x40(%rsp)
jmp 0x12385
movq 0x48(%rsp), %rdi
movq 0x60(%rsp), %rcx
movq 0x40(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rcx), %rax
movq 0x20(%rcx), %rdx
movl 0x10(%rax), %ecx
callq 0x42b00
jmp 0x123a9
movq 0x48(%rsp), %rax
movq %rax, 0xa8(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x16dd0
jmp 0x123c5
movq 0x60(%rsp), %rdi
addq $0x88, %rdi
leaq 0xd8(%rsp), %rsi
callq 0x16f00
movq %rax, 0x38(%rsp)
jmp 0x123e5
movq 0x60(%rsp), %rdi
movq 0x38(%rsp), %rax
movq %rax, 0x98(%rsp)
addq $0x88, %rdi
movq 0x98(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x90(%rsp), %rsi
callq 0x16f30
movq %rax, 0x30(%rsp)
jmp 0x12422
movq 0x60(%rsp), %rax
movq 0x30(%rsp), %rcx
movq %rcx, 0x88(%rsp)
addq $0x88, %rax
movq %rax, 0x18(%rsp)
leaq 0xd8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x15b90
movq %rdx, 0x20(%rsp)
movl %eax, 0x2c(%rsp)
jmp 0x1245f
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rax
movl 0x2c(%rsp), %ecx
movl %ecx, 0x78(%rsp)
movq %rax, 0x80(%rsp)
leaq 0x78(%rsp), %rsi
callq 0x15b40
movb %dl, 0xf(%rsp)
movq %rax, 0x10(%rsp)
jmp 0x1248e
movb 0xf(%rsp), %al
movq 0x10(%rsp), %rcx
movq %rcx, 0x68(%rsp)
movb %al, 0x70(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x16e30
jmp 0x124af
jmp 0x12500
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb8(%rsp)
movl %eax, 0xb4(%rsp)
jmp 0x1255f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb8(%rsp)
movl %eax, 0xb4(%rsp)
jmp 0x12523
movq 0x48(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb8(%rsp)
movl %eax, 0xb4(%rsp)
callq 0x84b0
jmp 0x12523
leaq 0xc0(%rsp), %rdi
callq 0x15c30
movl 0xd8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd8(%rsp)
jmp 0x12254
leaq 0xc0(%rsp), %rdi
callq 0x15c30
jmp 0x1255f
movq 0x60(%rsp), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edi
callq 0x86e0
jmp 0x12545
jmp 0x1222d
leaq 0xe0(%rsp), %rdi
callq 0x15c30
addq $0xf8, %rsp
retq
leaq 0xe0(%rsp), %rdi
callq 0x15c30
movq 0xb8(%rsp), %rdi
callq 0x8820
nopl (%rax)