Exchange the current thread's active AsyncStackRoot with the specified AsyncStackRoot pointer, returning the old AsyncStackRoot pointer.

Synopsis

Declared in <folly/tracing/AsyncStack.h>

[[nodiscard]]
AsyncStackRoot*
exchangeCurrentAsyncStackRoot(AsyncStackRoot* newRoot) noexcept;

Description

This is intended to be used to update the thread‐local pointer when context‐switching fiber stacks.

Return Value

The previously active stack root, or null if there was none.

Note

The return value should not be discarded.

Parameters

Name

Description

newRoot

The stack root to install as the current thread's root.

Created with MrDocs