Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Atomic Operations | Documents for CO #52

Open
idealvin opened this issue Oct 5, 2021 · 0 comments
Open

Atomic Operations | Documents for CO #52

idealvin opened this issue Oct 5, 2021 · 0 comments

Comments

@idealvin
Copy link
Owner

idealvin commented Oct 5, 2021

https://idealvin.github.io/en/co/atomic/

include: co/atomic.h.
#Arithmetic operations #atomic_inc template inline T atomic_inc(T* p); Atomic increment, T is any integer type with a length of 1, 2, 4, 8 bytes, and the parameter p is a pointer of type T.
This function performs an increment operation on the integer pointed to by p and returns the result after increment.
Example
int i = 0; uint64 u = 0; int r = atomic_inc(&i); // i -> 1, r = 1 uint64 x = atomic_inc(&u); // u -> 1, x = 1 #atomic_fetch_inc template inline T atomic_fetch_inc(T* p); The same as atomic_inc, but returns the value before increment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant