// File: sisong[P]ApkDiffPatch/HDiffPatch/libParallel/parallel_channel.cpp
// Function: CChannel_import::send(void*, bool)
bool send(TChanData data,bool isWait){
        assert(data!=0);
        {
            CAutoLocker locker(_locker);
            while (true) {
                if (_isClosed) return false;
                if ((_maxDataCount<=0)||(_dataList.size()<(size_t)_maxDataCount)) {
                    try{
                        _dataList.push_back(data);
                    }catch(...){
                        return false;
                    }
                    condvar_signal(_acceptCond);
                    if (_maxDataCount==0) //must wait accepted?
                        break;// to wait accepted
                    else
                        return true; //ok
                }else if(!isWait){
                    return false;
                }//else wait
                ++_waitingCount;
                condvar_wait(_sendCond,&locker);
                --_waitingCount;
            }
        }

        //wait accepted
        while (true) { //wait _dataList empty
            {
                CAutoLocker locker(_locker);
                if (_isClosed) break;
                if (_dataList.empty()) break;
            }
            this_thread_yield(); //todo:优化;
        }
        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movb %dl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
andb $0x1, %al
movb %al, -0x19(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x8fd78
jmp 0x8fd97
leaq 0x260d7(%rip), %rdi     # 0xb5e56
leaq 0x2607e(%rip), %rsi     # 0xb5e04
movl $0x55, %edx
leaq 0x260cc(%rip), %rcx     # 0xb5e5e
callq 0x4270
movq -0x60(%rbp), %rax
movq (%rax), %rsi
leaq -0x30(%rbp), %rdi
callq 0x42c30
jmp 0x8fda9
movq -0x60(%rbp), %rax
movb 0x78(%rax), %al
testb $0x1, %al
je 0x8fdc4
movb $0x0, -0x1(%rbp)
movl $0x1, -0x34(%rbp)
jmp 0x8febd
movq -0x60(%rbp), %rax
cmpq $0x0, 0x68(%rax)
jle 0x8fdea
movq -0x60(%rbp), %rdi
addq $0x18, %rdi
callq 0x90b70
movq -0x60(%rbp), %rcx
cmpq 0x68(%rcx), %rax
jae 0x8fe6e
movq -0x60(%rbp), %rdi
addq $0x18, %rdi
leaq -0x18(%rbp), %rsi
callq 0x90c20
jmp 0x8fdfd
jmp 0x8fe45
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
movq -0x40(%rbp), %rdi
callq 0x4150
movb $0x0, -0x1(%rbp)
movl $0x1, -0x34(%rbp)
callq 0x45d0
jmp 0x8fe26
jmp 0x8febd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x42f60
jmp 0x8ff44
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x8f200
jmp 0x8fe54
movq -0x60(%rbp), %rax
cmpq $0x0, 0x68(%rax)
jne 0x8fe61
jmp 0x8feb6
movb $0x1, -0x1(%rbp)
movl $0x1, -0x34(%rbp)
jmp 0x8febd
testb $0x1, -0x19(%rbp)
jne 0x8fe81
movb $0x0, -0x1(%rbp)
movl $0x1, -0x34(%rbp)
jmp 0x8febd
jmp 0x8fe83
movq -0x60(%rbp), %rax
movq 0x70(%rax), %rcx
incq %rcx
movq %rcx, 0x70(%rax)
movq 0x8(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x8f1c0
jmp 0x8fea1
movq -0x60(%rbp), %rax
movq 0x70(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x70(%rax)
jmp 0x8fda7
movl $0x0, -0x34(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x42f60
movl -0x34(%rbp), %eax
testl %eax, %eax
je 0x8fed1
jmp 0x8fecf
jmp 0x8ff39
jmp 0x8fed3
movq -0x60(%rbp), %rax
movq (%rax), %rsi
leaq -0x58(%rbp), %rdi
callq 0x42c30
movq -0x60(%rbp), %rax
movb 0x78(%rax), %al
testb $0x1, %al
je 0x8fef7
movl $0x5, -0x34(%rbp)
jmp 0x8ff1a
movq -0x60(%rbp), %rdi
addq $0x18, %rdi
callq 0x90b10
testb $0x1, %al
jne 0x8ff0a
jmp 0x8ff13
movl $0x5, -0x34(%rbp)
jmp 0x8ff1a
movl $0x0, -0x34(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x42f60
movl -0x34(%rbp), %eax
testl %eax, %eax
je 0x8ff2e
jmp 0x8ff2c
jmp 0x8ff35
callq 0x8f260
jmp 0x8fed3
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x60, %rsp
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x4680
nopl (%rax)