Skip to content
Advertisement

Tag: atomic

How to use atomic variables in C?

I need to use an atomic variable in C as this variable is accessed across different threads. Don’t want a race condition. My code is running on CentOS. What are my options? Answer If you are using GCC on your CentOS platform, then you can use the __atomic built-in functions. Of particular interest might be this function: — Built-in Function:

Is rename() atomic?

I am not being able to check this via experiments and could not gather it from the man pages as well. Say I have two processes, one moving(rename) file1 from directory1 to directory2. Say the other process running concurrently copies the contents of directory1 and directory2 to another location. Is it possible that the copy happens in such a way

Advertisement