// File: /workspace/github_cpp_makefile_star2_O1/switch-st[P]SimpleThreadPool/test.cpp
// Function: main
int main(int argc, char** argv)
{
	cout << "type job pool" << endl;
    STJPool job_pool(10, 20);

    cout << "begin" << endl;
    for (int i = 0; i < 100; ++i)
	{
        A a;
        SJob job(&A::fa, &a, i);
        job_pool.add_job_block(job);
	}
	cout << "end" << endl;

	sleep(5);
	job_pool.stop();
	cout << "done" << endl;


	cout << endl << endl << endl;
	cout << "type function pool" << endl;
	STFPool func_pool;
	func_pool.SetMaxPoolSize(10);

    int num1 = 1;
    int* p1 = &num1;
    func_pool.AddThread(boost::bind(func1, (void*)p1));
    int num2 = 2;
    int* p2 = &num2;
    func_pool.AddThread(boost::bind(func1, (void*)p2));
    int num3 = 3;
    int* p3 = &num3;
    func_pool.AddThread(boost::bind(func1, (void*)p3));
    func_pool.AddThread(func2);

    while(1)
    {
        cout << "\t\t\tthread pool size = " << func_pool.GetPoolSize() << endl;
        if (func_pool.GetPoolSize() == 0)
        {
            break;
        }
        sleep(1);
    }

    func_pool.StopThreadPool();

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
movq 0xd852(%rip), %rbx      # 0x12fd0
leaq 0x68ba(%rip), %rsi      # 0xc03f
movl $0xd, %edx
movq %rbx, %rdi
callq 0x52b0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5240
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x5180
leaq 0x68(%rsp), %rdi
movl $0xa, %esi
movl $0x14, %edx
callq 0x5d44
leaq 0x6879(%rip), %rsi      # 0xc04d
movl $0x5, %edx
movq %rbx, %rdi
callq 0x52b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x5240
movsbl %al, %esi
movq 0xd7d1(%rip), %rdi      # 0x12fd0
callq 0x5040
movq %rax, %rdi
callq 0x5180
xorl %ebx, %ebx
leaq 0x38(%rsp), %r14
leaq 0x5f6(%rip), %r15       # 0x5e10
leaq 0x18(%rsp), %r12
leaq 0xc(%rsp), %r13
leaq 0x68(%rsp), %rbp
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %r13, %rcx
movl %ebx, %r8d
callq 0x5e7c
movq %rbp, %rdi
movq %r12, %rsi
callq 0x5f10
movq %r14, %rdi
callq 0x6f84
movq %r12, %rdi
callq 0x6cf0
incl %ebx
cmpl $0x64, %ebx
jne 0x5829
movq 0xd76b(%rip), %rbx      # 0x12fd0
leaq 0x67e7(%rip), %rsi      # 0xc053
movl $0x3, %edx
movq %rbx, %rdi
callq 0x52b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x5240
movsbl %al, %esi
movq 0xd739(%rip), %rdi      # 0x12fd0
callq 0x5040
movq %rax, %rdi
callq 0x5180
movl $0x5, %edi
callq 0x51b0
leaq 0x90(%rsp), %rbx
movb $0x1, 0x1b0(%rbx)
movq %rbx, %rdi
callq 0x965a
leaq 0x1d8(%rsp), %r14
movq %r14, %rdi
callq 0x96a4
movq 0xd6f4(%rip), %r15      # 0x12fd0
leaq 0x6774(%rip), %rsi      # 0xc057
movl $0x4, %edx
movq %r15, %rdi
callq 0x52b0
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x5240
movsbl %al, %esi
movq 0xd6c2(%rip), %r15      # 0x12fd0
movq %r15, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x5180
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x5240
movsbl %al, %esi
movq 0xd694(%rip), %rdi      # 0x12fd0
callq 0x5040
movq %rax, %rdi
callq 0x5180
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x5240
movsbl %al, %esi
movq %r15, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x5180
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x5240
movsbl %al, %esi
movq %r15, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x5180
movq 0xd62c(%rip), %r15      # 0x12fd0
leaq 0x66b1(%rip), %rsi      # 0xc05c
movl $0x12, %edx
movq %r15, %rdi
callq 0x52b0
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x5240
movsbl %al, %esi
movq 0xd5fa(%rip), %rdi      # 0x12fd0
callq 0x5040
movq %rax, %rdi
callq 0x5180
leaq 0x18(%rsp), %rdi
callq 0x5f80
leaq 0x18(%rsp), %rdi
movl $0xa, %esi
callq 0x6030
leaq 0xc(%rsp), %rdx
movl $0x1, (%rdx)
leaq -0x3e2(%rip), %rsi      # 0x562c
leaq 0x18(%rsp), %rdi
callq 0x6068
leaq 0x14(%rsp), %rdx
movl $0x2, (%rdx)
leaq -0x3fe(%rip), %rsi      # 0x562c
leaq 0x18(%rsp), %rdi
callq 0x6068
leaq 0x10(%rsp), %rdx
movl $0x3, (%rdx)
leaq -0x41a(%rip), %rsi      # 0x562c
leaq 0x18(%rsp), %rdi
callq 0x6068
leaq -0x39e(%rip), %rsi      # 0x56b9
leaq 0x18(%rsp), %rdi
callq 0x60fc
movq 0xd568(%rip), %r15      # 0x12fd0
leaq 0x6600(%rip), %r12      # 0xc06f
leaq 0x18(%rsp), %r13
movl $0x16, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x52b0
movq %r13, %rdi
callq 0x7864
movq 0x50(%rsp), %rbp
movq %r13, %rdi
callq 0x7e50
movq %r15, %rdi
movl %ebp, %esi
callq 0x53e0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x5240
movsbl %al, %esi
movq %rbp, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x5180
movq %r13, %rdi
callq 0x7864
movl 0x50(%rsp), %ebp
movq %r13, %rdi
callq 0x7e50
testq %rbp, %rbp
je 0x5af2
movl $0x1, %edi
callq 0x51b0
jmp 0x5a74
leaq 0x18(%rsp), %rdi
callq 0x6186
leaq 0x18(%rsp), %rdi
callq 0x6262
movq %r14, %rdi
callq 0x6e32
leaq 0x178(%rsp), %rdi
callq 0x7738
leaq 0x150(%rsp), %rdi
callq 0x6f84
leaq 0xf8(%rsp), %rdi
callq 0x7738
leaq 0xd0(%rsp), %rdi
callq 0x6f84
leaq 0xa8(%rsp), %rdi
callq 0x6f84
movq %rbx, %rdi
callq 0x77a2
leaq 0x68(%rsp), %rdi
callq 0x6f84
xorl %eax, %eax
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5b9f
jmp 0x5b9f
jmp 0x5b9f
jmp 0x5b81
jmp 0x5b9f
jmp 0x5b81
movq %rax, %rbx
jmp 0x5bac
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x6f84
leaq 0x18(%rsp), %rdi
callq 0x6cf0
jmp 0x5bac
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x6262
leaq 0x68(%rsp), %rdi
callq 0x6360
movq %rbx, %rdi
callq 0x53f0