• Nick Terrell's avatar
    Reset contexts when returning to pool · 87d9f1da
    Nick Terrell authored
    Summary:
    Currently, the first thing you want to do when getting a context from the pool is
    reset it, because you don't know the state the last user left it in. This is bug
    prone, because you may forget to reset the context. Instead, the pool should
    handle the resetting logic, so it cannot be forgotten.
    
    This diff adds a `Resetter` to the pool, and the reset function is called every
    time a context is returned to the pool. I chose to reset when returning to the
    pool instead of when retrieving a context because that gives the context a
    chance to free any resources it doesn't expect to need in the future before it
    potentially becomres idle.
    
    Reviewed By: Cyan4973
    
    Differential Revision: D26439710
    
    fbshipit-source-id: 8b9afa3db2fda4d167f0fd5307791e8a8a4f283c
    87d9f1da
CompressionContextPoolSingletons.cpp 2.19 KB