// File: renbozqin[P]blocking_queue/test.cpp
// Function: main
int main(int argc, char* argv[]){

	BlockingQueue<int> queue;
	BlockingQueue<int> queue2;

	double st = getMS();
	std::thread t1(thread1<int>,std::ref(queue));
	std::thread t2(thread2<int>,std::ref(queue),std::ref(queue2));
	std::thread t3(thread3<int>,std::ref(queue2));

	t1.join();
	t2.join();
	t3.join();
	double et = getMS();
	std::cout << "Muil threads use time: " << et-st << "ms" << std::endl;

	st = getMS();
	thread1(queue);
	thread2(queue,queue2);
	thread3(queue2);
	et = getMS();
	std::cout << "Single thread use time: " << et-st << "ms" << std::endl;

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x280, %rsp            # imm = 0x280
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x2790
leaq -0x1d0(%rbp), %rdi
callq 0x2790
jmp 0x23d3
callq 0x2740
movsd %xmm0, -0x230(%rbp)
jmp 0x23e2
movsd -0x230(%rbp), %xmm0
movsd %xmm0, -0x1e8(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x2890
movq %rax, -0x1f8(%rbp)
leaq 0x424(%rip), %rsi       # 0x2830
leaq -0x1f0(%rbp), %rdi
leaq -0x1f8(%rbp), %rdx
callq 0x28c0
jmp 0x2421
leaq -0xf0(%rbp), %rdi
callq 0x2890
movq %rax, -0x208(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x2890
movq %rax, -0x210(%rbp)
leaq 0x532(%rip), %rsi       # 0x2980
leaq -0x200(%rbp), %rdi
leaq -0x208(%rbp), %rdx
leaq -0x210(%rbp), %rcx
callq 0x2a00
jmp 0x246a
leaq -0x1d0(%rbp), %rdi
callq 0x2890
movq %rax, -0x220(%rbp)
leaq 0x63c(%rip), %rsi       # 0x2ac0
leaq -0x218(%rbp), %rdi
leaq -0x220(%rbp), %rdx
callq 0x28c0
jmp 0x2499
leaq -0x1f0(%rbp), %rdi
callq 0x21e0
jmp 0x24a7
leaq -0x200(%rbp), %rdi
callq 0x21e0
jmp 0x24b5
leaq -0x218(%rbp), %rdi
callq 0x21e0
jmp 0x24c3
callq 0x2740
movsd %xmm0, -0x238(%rbp)
jmp 0x24d2
movsd -0x238(%rbp), %xmm0
movsd %xmm0, -0x228(%rbp)
movq 0xdaef(%rip), %rdi      # 0xffd8
leaq 0x7b20(%rip), %rsi      # 0xa010
callq 0x2130
movq %rax, -0x240(%rbp)
jmp 0x24fe
movq -0x240(%rbp), %rdi
movsd -0x228(%rbp), %xmm0
movsd -0x1e8(%rbp), %xmm1
subsd %xmm1, %xmm0
callq 0x2210
movq %rax, -0x248(%rbp)
jmp 0x2527
movq -0x248(%rbp), %rdi
leaq 0x7af3(%rip), %rsi      # 0xa028
callq 0x2130
movq %rax, -0x250(%rbp)
jmp 0x2543
movq -0x250(%rbp), %rdi
movq 0xda6f(%rip), %rsi      # 0xffc0
callq 0x2150
jmp 0x2558
callq 0x2740
movsd %xmm0, -0x258(%rbp)
jmp 0x2567
movsd -0x258(%rbp), %xmm0
movsd %xmm0, -0x1e8(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x2830
jmp 0x2585
leaq -0xf0(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
callq 0x2980
jmp 0x259a
leaq -0x1d0(%rbp), %rdi
callq 0x2ac0
jmp 0x25a8
callq 0x2740
movsd %xmm0, -0x260(%rbp)
jmp 0x25b7
movsd -0x260(%rbp), %xmm0
movsd %xmm0, -0x228(%rbp)
movq 0xda0a(%rip), %rdi      # 0xffd8
leaq 0x7a56(%rip), %rsi      # 0xa02b
callq 0x2130
movq %rax, -0x268(%rbp)
jmp 0x25e3
movq -0x268(%rbp), %rdi
movsd -0x228(%rbp), %xmm0
movsd -0x1e8(%rbp), %xmm1
subsd %xmm1, %xmm0
callq 0x2210
movq %rax, -0x270(%rbp)
jmp 0x260c
movq -0x270(%rbp), %rdi
leaq 0x7a0e(%rip), %rsi      # 0xa028
callq 0x2130
movq %rax, -0x278(%rbp)
jmp 0x2628
movq -0x278(%rbp), %rdi
movq 0xd98a(%rip), %rsi      # 0xffc0
callq 0x2150
jmp 0x263d
movl $0x0, -0x4(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x2b30
leaq -0x200(%rbp), %rdi
callq 0x2b30
leaq -0x1f0(%rbp), %rdi
callq 0x2b30
leaq -0x1d0(%rbp), %rdi
callq 0x2b60
leaq -0xf0(%rbp), %rdi
callq 0x2b60
movl -0x4(%rbp), %eax
addq $0x280, %rsp            # imm = 0x280
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
jmp 0x271e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
jmp 0x2712
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
jmp 0x2706
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
jmp 0x26fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x2b30
leaq -0x200(%rbp), %rdi
callq 0x2b30
leaq -0x1f0(%rbp), %rdi
callq 0x2b30
leaq -0x1d0(%rbp), %rdi
callq 0x2b60
leaq -0xf0(%rbp), %rdi
callq 0x2b60
movq -0x1d8(%rbp), %rdi
callq 0x21f0
nopw %cs:(%rax,%rax)