• Tollef Fog Heen's avatar
    Merge r4069: Factor out session allocation for background threads · 801110e5
    Tollef Fog Heen authored
    Fix an inconsequential oversight in session management, and prevent it
    from happening again:
    
    We optimize session allocation, SES_New(), to minimize the amount of
    locking the VCA_thread participates in with flip-flop lists of free
    sessions: Allocate from one list, free to the other, flip lists only
    when necessary.
    
    This scheme only works if nobody but VCA_thread calls SES_New().
    
    Background worker threads need dummy sessions and thus called into
    SES_New() as well.
    
    These calls all happen during startup, so they do in fact not mess up
    the locking, but made mockery of a number of very stern comments.
    
    Add SES_Alloc() for such "other uses" and enforce VCA_thread monopoly
    with an assert.
    
    
    
    git-svn-id: http://www.varnish-cache.org/svn/branches/2.0@4259 d4fa192b-c00b-0410-8231-f00ffab90ce4
    801110e5
cache_ws.c 4.36 KB