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

Method release

include/process/owned.hpp:177–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175
176template <typename T>
177T* Owned<T>::release()
178{
179 if (data == nullptr) {
180 // The ownership of this pointer has already been lost.
181 return nullptr;
182 }
183
184 // Atomically set the pointer 'data->t' to `nullptr`.
185 T* old = data->t.exchange(nullptr);
186 if (old == nullptr) {
187 // The ownership of this pointer has already been lost.
188 return nullptr;
189 }
190
191 data.reset();
192 return old;
193}
194
195
196template <typename T>

Callers 1

TESTFunction · 0.45

Calls 1

resetMethod · 0.45

Tested by 1

TESTFunction · 0.36