MCPcopy Create free account
hub / github.com/beefytech/Beef / Exchange

Method Exchange

BeefRT/gperftools/src/malloc_hook.cc:162–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160// The code below is DEPRECATED.
161template<typename PtrT>
162PtrT AtomicPtr<PtrT>::Exchange(PtrT new_val) {
163 base::subtle::GMemoryBarrier(); // Release semantics.
164 // Depending on the system, NoBarrier_AtomicExchange(AtomicWord*)
165 // may have been defined to return an AtomicWord, Atomic32, or
166 // Atomic64. We hide that implementation detail here with an
167 // explicit cast. This prevents MSVC 2005, at least, from complaining.
168 PtrT old_val = reinterpret_cast<PtrT>(static_cast<AtomicWord>(
169 base::subtle::NoBarrier_AtomicExchange(
170 &data_,
171 reinterpret_cast<AtomicWord>(new_val))));
172 base::subtle::GMemoryBarrier(); // And acquire semantics.
173 return old_val;
174}
175
176template<typename PtrT>
177PtrT AtomicPtr<PtrT>::CompareAndSwap(PtrT old_val, PtrT new_val) {

Callers 8

MallocHook_SetNewHookFunction · 0.45
MallocHook_SetDeleteHookFunction · 0.45
MallocHook_SetMmapHookFunction · 0.45
MallocHook_SetMunmapHookFunction · 0.45
MallocHook_SetMremapHookFunction · 0.45
MallocHook_SetSbrkHookFunction · 0.45

Calls 2

GMemoryBarrierFunction · 0.50
NoBarrier_AtomicExchangeFunction · 0.50

Tested by

no test coverage detected