• Dave Watson's avatar
    dynamic CPUThreadPoolExecutor · 68a6b5b5
    Dave Watson authored
    Summary:
    This diff adds dynamic thread creation/destruction to ThreadPoolExecutor (mostly CPU).
    
    1) Threads are lazily created when the first task is add()ed (or getEventBase is called), applies to both IO and CPU
    
    and
    
    2) after a timeout in LifoSem, threads are joined in CPUThreadPoolExecutor.
    
    Most of the logic is in ThreadPoolExecutor.  A separate dynamic IOThreadPoolExecutor will be a follow on diff.
    
    To keep the previous behavior, users can set minthread == maxthreads, or gflags --dynamic_cputhreadpoolexecutor=false
    
    Reviewed By: magedm
    
    Differential Revision: D7477390
    
    fbshipit-source-id: 855a35380861111de33656e8fb1b681ae8cd2807
    68a6b5b5
ThreadPoolExecutorTest.cpp 17.3 KB