Commit 922196cd authored by DEPRECATED (Jonathan Mace) (Use @JonathanMace instead)'s avatar DEPRECATED (Jonathan Mace) (Use @JonathanMace instead)
Browse files

Add baggage swap operation

parent 16d1cfd1
......@@ -67,6 +67,7 @@ namespace ThreadLocalBaggage {
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 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
}
......
......@@ -25,6 +25,12 @@ void ThreadLocalBaggage::Set(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() {
current_threads_baggage = Baggage();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment