Skip to content

Commit

Permalink
allow extension of the lifetime of ContextStorage. (#1214)
Browse files Browse the repository at this point in the history
  • Loading branch information
esigo authored Feb 19, 2022
1 parent 1026ec3 commit 3508d7c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions api/include/opentelemetry/context/runtime_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,18 @@ class RuntimeContext
GetStorage() = storage;
}

/**
* Provide a pointer to const runtime context storage.
*
* The returned pointer can only be used for extending the lifetime of the runtime context
* storage.
*
*/
static nostd::shared_ptr<const RuntimeContextStorage> GetConstRuntimeContextStorage() noexcept
{
return GetRuntimeContextStorage();
}

private:
static nostd::shared_ptr<RuntimeContextStorage> GetRuntimeContextStorage() noexcept
{
Expand Down

0 comments on commit 3508d7c

Please sign in to comment.