O'Reilly logo

C++ Concurrency in Action: Practical Multithreading by Anthony Williams

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Note

This is an atomic read-modify-write operation for the memory location comprising *this.

Std::Atomic_Fetch_Sub Nonmember Function

Atomically reads the value from an atomic<T*> instance and replaces it with that value minus the supplied value i using standard pointer arithmetic rules.

Declaration

T* atomic_fetch_sub(volatile atomic<T*>* p, ptrdiff_t i) noexcept;
T* atomic_fetch_sub(atomic<T*>* p, ptrdiff_t i) noexcept;

Effects

return p->fetch_sub(i);
Std::Atomic_Fetch_Sub_Explicit Nonmember Function

Atomically reads the value from an atomic<T*> instance and replaces it with that value minus the supplied value i using standard pointer arithmetic rules.

Declaration

T* atomic_fetch_sub_explicit( volatile atomic<T*>* p, ptrdiff_t ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required