Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Reyhaneh Karimipour
xtrace-cpp
Commits
922196cd
Commit
922196cd
authored
May 21, 2019
by
DEPRECATED (Jonathan Mace) (Use @JonathanMace instead)
Browse files
Add baggage swap operation
parent
16d1cfd1
Changes
2
Show whitespace changes
Inline
Side-by-side
include/baggage.h
View file @
922196cd
...
@@ -67,6 +67,7 @@ namespace ThreadLocalBaggage {
...
@@ -67,6 +67,7 @@ namespace ThreadLocalBaggage {
void
Delete
();
// Delete the current thread's baggage
void
Delete
();
// Delete the current thread's baggage
void
Set
(
Baggage
new_baggage
);
// Set the current thread's baggage to the provided baggage, destroying the previous baggage
void
Set
(
Baggage
new_baggage
);
// Set the current thread's baggage to the provided baggage, destroying the previous baggage
void
Join
(
Baggage
&
otherBaggage
);
// Merge the current thread's baggage with the provided baggage
void
Join
(
Baggage
&
otherBaggage
);
// Merge the current thread's baggage with the provided baggage
Baggage
Swap
(
Baggage
otherBaggage
);
// Set the current thread's baggage to the provided baggage, and return the previous baggage
}
}
...
...
src/thread_local_baggage.cpp
View file @
922196cd
...
@@ -25,6 +25,12 @@ void ThreadLocalBaggage::Set(Baggage new_baggage) {
...
@@ -25,6 +25,12 @@ void ThreadLocalBaggage::Set(Baggage new_baggage) {
current_threads_baggage
=
new_baggage
;
current_threads_baggage
=
new_baggage
;
}
}
Baggage
ThreadLocalBaggage
::
Swap
(
Baggage
other_baggage
)
{
Baggage
prev
=
current_threads_baggage
;
current_threads_baggage
=
other_baggage
;
return
prev
;
}
void
ThreadLocalBaggage
::
Delete
()
{
void
ThreadLocalBaggage
::
Delete
()
{
current_threads_baggage
=
Baggage
();
current_threads_baggage
=
Baggage
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment