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

Commit cefa941

Browse files
meastmanisaachier
authored andcommitted
Implement SpanContext::Clone (#138)
This was added to the opentracing API in opentracing/opentracing-cpp#56 Signed-off-by: Matt Eastman <[email protected]>
1 parent ffdd052 commit cefa941

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/jaegertracing/SpanContext.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include <iomanip>
2121
#include <iostream>
22+
#include <memory>
2223
#include <mutex>
2324
#include <string>
2425
#include <unordered_map>
@@ -164,6 +165,13 @@ class SpanContext : public opentracing::SpanContext {
164165
forEachBaggageItem(f);
165166
}
166167

168+
std::unique_ptr<opentracing::SpanContext> Clone() const noexcept
169+
{
170+
std::lock_guard<std::mutex> lock(_mutex);
171+
return std::unique_ptr<opentracing::SpanContext>(
172+
new SpanContext(*this));
173+
}
174+
167175
friend bool operator==(const SpanContext& lhs, const SpanContext& rhs)
168176
{
169177
{

0 commit comments

Comments
 (0)