Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Header file for atomic builtins of gcc

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.

like image 323
Tejas Avatar asked Nov 05 '22 13:11

Tejas


1 Answers

There are no header requirements but you may need to explicitly specify the architecture (using the -march flag)

like image 90
Foo Bah Avatar answered Nov 14 '22 22:11

Foo Bah