MCPcopy Create free account
hub / github.com/3rdparty/libprocess / share

Method share

include/process/owned.hpp:157–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155
156template <typename T>
157Shared<T> Owned<T>::share()
158{
159 if (data == nullptr) {
160 // The ownership of this pointer has already been lost.
161 return Shared<T>(nullptr);
162 }
163
164 // Atomically set the pointer 'data->t' to `nullptr`.
165 T* old = data->t.exchange(nullptr);
166 if (old == nullptr) {
167 // The ownership of this pointer has already been lost.
168 return Shared<T>(nullptr);
169 }
170
171 data.reset();
172 return Shared<T>(old);
173}
174
175
176template <typename T>

Callers 1

TESTFunction · 0.80

Calls 1

resetMethod · 0.45

Tested by 1

TESTFunction · 0.64