Search Results

Search found 2 results on 1 pages for 'osatomic'.

Page 1/1 | 1 

  • MacOSX: OSAtomic vs OSAtomicBarrier

    - by anon
    For the functions here: #include <libkern/OSAtomic.h> there are OSAtomic and OSAtomicBarrier versions. However, the documentation does not show sample code for: When is it safe to use just OSAtomic, without the OSAtomicBarrier version When is it that OSAtomic would be unsafe, but OSAtomiBarrier would be safe. Can anyone provide explainations + sample codes? [Random ramblings of "your opinion" without actual code is useless. Readers: please down vote such answers; and vigrously upvote answers with actual code.] [C/C++ code preferred; Assembly okay too.]

    Read the article

  • Clarification of atomic memory access for different OSs

    - by murrekatt
    I'm currently porting a Windows C++ library to MacOS as a hobby project as a learning experience. I stumbled across some code using the Win Interlocked* functions and thus I've been trying to read up on the subject in general. Reading related questions here in SO, I understand there are different ways to do these operations depending on the OS. Interlocked* in Windows, OSAtomic* in MacOS and I also found that compilers have builtin (intrinsic) operations for this. After reading gcc builtin atomic memory access, I'm left wondering what is the difference between intrinsic and the OSAtomic* or Interlocked* ones? I mean, can I not choose between OSAtomic* or gcc builtin if I'm on MacOS when I use gcc? The same if I'd be on Windows using gcc. I also read that on Windows Interlocked* come as both inline and intrinsic versions. What to consider when choosing between intrinsic or inline? In general, are there multiple options on OSs what to use? Or is this again "it depends"? If so, what does it depend on? Thanks!

    Read the article

1