// File: /workspace/github_cpp_makefile_star2_O2/enbock[P]Warp10Server/ulib/src/Thread.cpp
// Function: u::ThreadSystem::destroy(u::Thread*)
void ThreadSystem::destroy(Thread *thread)
{
	int64 i,l;
	_access.lock();
	l = _run.size();
	for(i=0; i<l; i++)
	{
		if(_run.at(i) == thread)
		{
			_run.erase(i);
#ifndef NDEBUG
			finish++;
			if(ThreadSystem::isTerminating)
				trace("Run queue="+Object::int2string(_build.size())
				+ "\trun="+Object::int2string(_run.size())
				+ "(peak:"+Object::int2string(peakRun)+")"
				+ "\tfinished="+Object::int2string(finish)
				);
#endif
			_access.unlock();
			delete thread;
			return;
		}
	}
	_access.unlock();
#ifndef NDEBUG
	error("A deleting thread was not found in the run queue.");
	assert(false==true);
#endif
	//delete thread;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x268, %rsp            # imm = 0x268
movq %rdi, %rbx
leaq 0x203680(%rip), %rdi    # 0x60c6b0
callq 0x407cb6
movq 0x20373c(%rip), %r12    # 0x60c778
subq 0x20372d(%rip), %r12    # 0x60c770
sarq $0x3, %r12
xorl %r14d, %r14d
testq %r12, %r12
cmovleq %r14, %r12
leaq 0x203718(%rip), %r15    # 0x60c770
cmpq %r14, %r12
je 0x4092ca
movq %r15, %rdi
movq %r14, %rsi
callq 0x40a106
cmpq %rbx, (%rax)
je 0x409076
incq %r14
jmp 0x409058
leaq 0x2036bb(%rip), %rdi    # 0x60c738
movq %r14, %rsi
callq 0x40a128
incq 0x2036fc(%rip)          # 0x60c788
cmpb $0x1, 0x203616(%rip)    # 0x60c6a9
jne 0x409295
movq $0x60d6a0, %rdi         # imm = 0x60D6A0
leaq 0x18cfd2(%rip), %rsi    # 0x596079
callq 0x474850
movq %rax, %r14
movq 0x203672(%rip), %rsi    # 0x60c728
subq 0x203663(%rip), %rsi    # 0x60c720
shrq $0x3, %rsi
leaq 0x210(%rsp), %rdi
callq 0x407f86
leaq 0x248(%rsp), %rdx
leaq 0x18d4b4(%rip), %rsi    # 0x596591
leaq 0x8(%rsp), %rdi
callq 0x404ee4
leaq 0x18d3ac(%rip), %rdx    # 0x59649a
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x404ec5
movq 0x203674(%rip), %rsi    # 0x60c778
subq 0x203665(%rip), %rsi    # 0x60c770
shrq $0x3, %rsi
leaq 0x1b8(%rsp), %rdi
callq 0x407f86
leaq 0x1f0(%rsp), %rdx
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x405951
leaq 0x18d366(%rip), %rdx    # 0x5964a0
leaq 0x68(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x404ec5
movl 0x203641(%rip), %esi    # 0x60c790
leaq 0x160(%rsp), %rdi
callq 0x407f86
leaq 0x198(%rsp), %rdx
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x405951
leaq 0x18d261(%rip), %rdx    # 0x5963de
leaq 0xa8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x404ec5
leaq 0x18d30e(%rip), %rdx    # 0x5964a7
leaq 0xc8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x404ec5
movl 0x2035d4(%rip), %esi    # 0x60c788
leaq 0x108(%rsp), %rdi
callq 0x407f86
leaq 0x140(%rsp), %rdx
leaq 0xe8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x405951
leaq 0xe8(%rsp), %rsi
movq %r14, %rdi
callq 0x4870d0
leaq 0x18ce90(%rip), %rsi    # 0x596085
movq %rax, %rdi
callq 0x474850
movq %rax, %rdi
callq 0x474130
leaq 0xe8(%rsp), %rdi
callq 0x484750
leaq 0x108(%rsp), %rdi
callq 0x404ab8
leaq 0xc8(%rsp), %rdi
callq 0x484750
leaq 0xa8(%rsp), %rdi
callq 0x484750
leaq 0x88(%rsp), %rdi
callq 0x484750
leaq 0x160(%rsp), %rdi
callq 0x404ab8
leaq 0x68(%rsp), %rdi
callq 0x484750
leaq 0x48(%rsp), %rdi
callq 0x484750
leaq 0x1b8(%rsp), %rdi
callq 0x404ab8
leaq 0x28(%rsp), %rdi
callq 0x484750
leaq 0x8(%rsp), %rdi
callq 0x484750
leaq 0x210(%rsp), %rdi
callq 0x404ab8
leaq 0x203414(%rip), %rdi    # 0x60c6b0
callq 0x407c72
testq %rbx, %rbx
je 0x4092ae
movq %rbx, %rdi
callq 0x408fd4
movl $0x98, %esi
movq %rbx, %rdi
callq 0x40a700
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x2033df(%rip), %rdi    # 0x60c6b0
callq 0x407c72
movq $0x60d580, %rdi         # imm = 0x60D580
leaq 0x18ce75(%rip), %rsi    # 0x596159
callq 0x474850
leaq 0x18d1c2(%rip), %rsi    # 0x5964b2
movq %rax, %rdi
callq 0x474850
leaq 0x18cd86(%rip), %rsi    # 0x596085
movq %rax, %rdi
callq 0x474850
movq %rax, %rdi
callq 0x474130
leaq 0x18d1ce(%rip), %rdi    # 0x5964e4
leaq 0x18d1d3(%rip), %rsi    # 0x5964f0
leaq 0x18d1db(%rip), %rcx    # 0x5964ff
pushq $0x64
popq %rdx
callq 0x4ca0f0
movq %rax, %rbx
jmp 0x40937c
movq %rax, %rbx
jmp 0x409389
movq %rax, %rbx
jmp 0x409396
movq %rax, %rbx
jmp 0x4093a3
movq %rax, %rbx
jmp 0x4093b0
movq %rax, %rbx
jmp 0x4093bd
movq %rax, %rbx
jmp 0x4093c7
movq %rax, %rbx
jmp 0x4093d1
movq %rax, %rbx
jmp 0x4093de
movq %rax, %rbx
jmp 0x4093e8
movq %rax, %rbx
jmp 0x4093f2
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x484750
leaq 0x108(%rsp), %rdi
callq 0x404ab8
leaq 0xc8(%rsp), %rdi
callq 0x484750
leaq 0xa8(%rsp), %rdi
callq 0x484750
leaq 0x88(%rsp), %rdi
callq 0x484750
leaq 0x160(%rsp), %rdi
callq 0x404ab8
leaq 0x68(%rsp), %rdi
callq 0x484750
leaq 0x48(%rsp), %rdi
callq 0x484750
leaq 0x1b8(%rsp), %rdi
callq 0x404ab8
leaq 0x28(%rsp), %rdi
callq 0x484750
leaq 0x8(%rsp), %rdi
callq 0x484750
leaq 0x210(%rsp), %rdi
callq 0x404ab8
movq %rbx, %rdi
callq 0x4b5490
nop