Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Commit

Permalink
Implement SpanContext::Clone (#138)
Browse files Browse the repository at this point in the history
This was added to the opentracing API in
opentracing/opentracing-cpp#56

Signed-off-by: Matt Eastman <[email protected]>
  • Loading branch information
meastman authored and isaachier committed Nov 21, 2018
1 parent ffdd052 commit cefa941
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/jaegertracing/SpanContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <iomanip>
#include <iostream>
#include <memory>
#include <mutex>
#include <string>
#include <unordered_map>
Expand Down Expand Up @@ -164,6 +165,13 @@ class SpanContext : public opentracing::SpanContext {
forEachBaggageItem(f);
}

std::unique_ptr<opentracing::SpanContext> Clone() const noexcept
{
std::lock_guard<std::mutex> lock(_mutex);
return std::unique_ptr<opentracing::SpanContext>(
new SpanContext(*this));
}

friend bool operator==(const SpanContext& lhs, const SpanContext& rhs)
{
{
Expand Down

0 comments on commit cefa941

Please sign in to comment.