I wanted to know what is the header file that is used for the atomic builtins of gcc? I want to use these 2 functions for implementing the mutex for a thread library that I am currently creating.
bool __sync_bool_compare_and_swap (type *ptr, type oldval type newval, ...);
type __sync_val_compare_and_swap (type *ptr, type oldval type newval, ...);
I tried searching on net, but just could not find the header file for these builtins. So if someone could point out what is the header file for these functions, it would be of great help. Also currently for testing, I will be compiling my code using gcc. But eventually I would be creating my own make file for compilation. Since these are gcc builtins, will there be any issues in usage of these functions when I compile using my own makefile? Will I have to take special care in my makefile in order to make these functions work? Any help would be greatly appreciated.
There are no header requirements but you may need to explicitly specify the architecture (using the -march
flag)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With