folly::IOBuf::isShared

Check if any chain buffers are shared.

Synopsis

Declared in <folly/io/IOBuf.h>

bool
isShared() const noexcept;

Description

Return true if at least one of the IOBufs in this chain are shared, or false if all of the IOBufs point to unique buffers.

Use isSharedOne() to only check this IOBuf rather than the entire chain.

If isShared() returns false, then you are probably the sole owner of the IOBuf chain and can write to it without needing to call unshare(). This is not a guarantee, since it is possible for another thread to concurrently acquire shared ownership.

Return Value

true if any IOBuf in the chain is shared. methodset Buffer Management