// File: Kingsford-Group[P]ghost2/include/./threadpool/./detail/pool_core.hpp
// Function: boost::threadpool::detail::pool_core<boost::function0<void>, boost::threadpool::fifo_scheduler, boost::threadpool::static_size, boost::threadpool::resize_controller, boost::threadpool::wait_for_all_tasks>::resize(unsigned long) volatile
bool resize(size_t const worker_count) volatile
    {
      locking_ptr<pool_type, recursive_mutex> lockedThis(*this, m_monitor); 

      if(!m_terminate_all_workers)
      {
        m_target_worker_count = worker_count;
      }
      else
      { 
        return false;
      }


      if(m_worker_count <= m_target_worker_count)
      { // increase worker count
        while(m_worker_count < m_target_worker_count)
        {
          try
          {
            worker_thread<pool_type>::create_and_attach(lockedThis->shared_from_this());
            m_worker_count++;
            m_active_worker_count++;	
          }
          catch(thread_resource_error)
          {
            return false;
          }
        }
      }
      else
      { // decrease worker count
        lockedThis->m_task_or_terminate_workers_event.notify_all();   // TODO: Optimize number of notified workers
      }

      return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rsi
movq %rsi, -0x98(%rbp)
movq %rsi, %rdx
addq $0xa0, %rdx
leaq -0x28(%rbp), %rdi
callq 0x87e40
movq -0x98(%rbp), %rax
movb 0x80(%rax), %al
testb $0x1, %al
jne 0x87ca3
movq -0x98(%rbp), %rax
movq -0x18(%rbp), %rcx
movq %rcx, 0x18(%rax)
jmp 0x87cb3
movb $0x0, -0x1(%rbp)
movl $0x1, -0x2c(%rbp)
jmp 0x87e06
movq -0x98(%rbp), %rcx
movq 0x10(%rcx), %rax
movq 0x18(%rcx), %rcx
cmpq %rcx, %rax
ja 0x87dd6
jmp 0x87ccd
movq -0x98(%rbp), %rcx
movq 0x10(%rcx), %rax
movq 0x18(%rcx), %rcx
cmpq %rcx, %rax
jae 0x87dd4
leaq -0x28(%rbp), %rdi
callq 0x88010
movq %rax, -0xa0(%rbp)
jmp 0x87cf7
movq -0xa0(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x88030
jmp 0x87d09
leaq -0x40(%rbp), %rdi
callq 0x87e80
jmp 0x87d14
leaq -0x40(%rbp), %rdi
callq 0x43900
movq -0x98(%rbp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
movq 0x20(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x20(%rax)
jmp 0x87dcf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x87d64
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x43900
movl -0x4c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x87e1d
movq -0x48(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x108f0
movq %rax, %rsi
leaq -0x90(%rbp), %rdi
callq 0x880b0
jmp 0x87d95
movq -0xa8(%rbp), %rdi
callq 0x102e0
movb $0x0, -0x1(%rbp)
movl $0x1, -0x2c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x43090
callq 0x10c10
jmp 0x87dbf
jmp 0x87e06
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x87e1d
jmp 0x87ccd
jmp 0x87dfb
leaq -0x28(%rbp), %rdi
callq 0x88010
movq %rax, -0xb0(%rbp)
jmp 0x87de8
movq -0xb0(%rbp), %rdi
addq $0x120, %rdi            # imm = 0x120
callq 0x87150
movb $0x1, -0x1(%rbp)
movl $0x1, -0x2c(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x880f0
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xb0, %rsp
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x880f0
movq -0x48(%rbp), %rdi
callq 0x10cc0
movq %rax, %rdi
callq 0x24210
nopw (%rax,%rax)