Issue
My system is debian 10. I want to implement atomic operations, but I find that there are no header files and API functions for atomic operations. What's the matter? Isn't atomic operation a kernel level function? Why not?
test_atomic.c:
#include <stdio.h>
#include <asm/atomic.h>
int main(void)
{
printf("test atomic!\n");
return 0;
}
compile error:
# gcc test_atomic.c
test_atomic.c:2:10: fatal error: asm/atomic.h: No such file or directory
#include <asm/atomic.h>
^~~~~~~~~~~~~~
compilation terminated.
man atomic API error:
# man atomic_add
No manual entry for atomic_add
Solution
For using atomic operations you need to use #include <stdatomic.h>
.
Answered By - InQusitive Answer Checked By - Clifford M. (WPSolving Volunteer)