Quantcast
Channel: Are there functions for performing atomic operations in the standard library? - Stack Overflow
Browsing all 6 articles
Browse latest View live

Answer by Michael Ekstrand for Are there functions for performing atomic...

Across all supported platforms, you can use use GLib's atomic operations. On platforms which have atomic operations built-in (e.g. assembly instructions), glib will use them. On other platforms, it...

View Article



Answer by Jerry Coffin for Are there functions for performing atomic...

Prior to C11The C library doesn't have any.On Linux, gcc provides some -- look for __sync_fetch_and_add, __sync_fetch_and_sub, and so on.In the case of Windows, look for InterlockedIncrement,...

View Article

Answer by AndiDog for Are there functions for performing atomic operations in...

On Windows, there are InterlockedExchange and the like. For Linux, you can take glibc's atomic macros - they're portable (see i486 atomic.h). I don't know a solution for the other operating systems.In...

View Article

Answer by dirkgently for Are there functions for performing atomic operations...

Not sure what you mean by the C runtime library. The language proper, or the standard library does not provide you with any means to do this. You'd need to use a OS specific library/API. Also, don't be...

View Article

Answer by bmargulies for Are there functions for performing atomic operations...

'Beneficial' is situational. Always, performance depends on circumstances. You may expect something wonderful to happen when you switch out a mutex for something like this, but you may get no benefit...

View Article


Are there functions for performing atomic operations in the standard library?

Are there functions for performing atomic operations (like increment / decrement of an integer) etc supported by C Run time library or any other utility libraries?If yes, what all operations can be...

View Article
Browsing all 6 articles
Browse latest View live




Latest Images