• Huapeng Zhou's avatar
    IOBuf: add a method to signal the underlying buffer as externally shared · 523ca0ed
    Huapeng Zhou authored
    Summary:
    There are use cases where 1). the underlying buffer is externally managed (e.g. by a slab allocator) and 2). we need to do bookkeeping when the wrapped IOBuf gets destroyed (e.g. reference counting). This diff adds a another method to mark the underlying buffer as shared with the external memory management mechanism.
    
    The `takeOwnership` doesn't meet the criteria since it assumes the ownership of the buffer, while in this case we need to signal it as externally managed so that hopefully callers won't try to modify the underlying buffer.
    
    Reviewed By: simpkins
    
    Differential Revision: D2662954
    
    fbshipit-source-id: e908c3ebeeefe9a5d332c75070f377fb1dad5acb
    523ca0ed
IOBuf.h 51.5 KB