• Poul-Henning Kamp's avatar
    Rewrite the worker thread pool code. · d51d92a2
    Poul-Henning Kamp authored
    Assign prefix WRK to the worker pool.
    
    Introduce a struct workreq since the prefetcher (when it happens) will
    not have a session to pass in.
    
    The worker threads get a cond_var each and are hung from a list in
    most recently used order.
    
    When a request is queued and the worker thread list is not empty,
    tickle the cond_var of the first one.
    
    If no threads were availble the max number of threads is not reached,
    try to start another worker thread.
    
    If the max was reached or the start filed (likely due to out of memory)
    indicate overflow and let the existing pool deal with it.
    
    Create only the minimum requested number of threads initially.
    
    Allow specification of the timeout before a dynamic worker thread commits
    suicide to be specified with -w.
    
    Default parameters are -w1,UINT_MAX,10 {min, max, timeout}
    
    
    
    
    git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@409 d4fa192b-c00b-0410-8231-f00ffab90ce4
    d51d92a2
heritage.h 1.05 KB