Quantcast
Channel: UNIX Portable Atomic Operations - Stack Overflow
Browsing all 8 articles
Browse latest View live

Answer by Ciro Santilli OurBigBook.com for UNIX Portable Atomic Operations

C11 atomics minimal runnable exampleWith the addition of threads in glibc 2.28, we can do both atomics and threading in pure C11.Example from:...

View Article



Answer by RubenLaguna for UNIX Portable Atomic Operations

As of C11 there is an optional Atomic library which provides atomic operations. This is portable to whatever platform that has a C11 compiler (like gcc-4.9) with this optional feature. The presence of...

View Article

Answer by user3033869 for UNIX Portable Atomic Operations

For anyone who stumbles upon this in the future, C11 atomics are the best way to do this now - I believe they will be included in GCC 4.9.

View Article

Answer by someGuy for UNIX Portable Atomic Operations

Since you asked for OS X:(and since cross platformity was raised in this thread.)OS X has functions OSAtomicAdd32() and friends. They are declared in "/usr/include/libkern/OSAtomic.h".See The Threading...

View Article

Answer by paxdiablo for UNIX Portable Atomic Operations

No, POSIX does not specify any portable lock-free/atomic operations. That's why they have pthreads.You're either going to have to use non-standard ways or stick with ptrheads for portability.

View Article


Answer by unwind for UNIX Portable Atomic Operations

I don't think there is.One way of solving it, licenses permitting of course, would be to copy the relevant per-architecture implementations from e.g. the Linux kernel space. I haven't followed the...

View Article

Answer by Goz for UNIX Portable Atomic Operations

AFAIK there are no cross-platform ways to do atomic operations. There may be a library out there but I don't know of. Its not particularly hard to roll your own, though.

View Article

UNIX Portable Atomic Operations

Is there a (POSIX-)portable way in C for atomic variable operations similar to a portable threading with pthread?Atomic operations are operations like "increment and get" that are executed atomically...

View Article

Browsing all 8 articles
Browse latest View live




Latest Images