[ovs-dev] [PATCH] ovs-atomics: Add atomic support for Windows.

Gurucharan Shetty shettyg at nicira.com
Thu Aug 28 20:31:04 UTC 2014


> I'd normally expect 64-bit reads and write to be atomic when we're
> building for x86-64:
>> +/* 64 bit reads and write are not atomic on x86.
Currently, we are only doing 32 bit builds. So, I put the following in
ovs-atomic.h to only include this file for 32 bit builds :
...
#elif _MSC_VER && defined(_M_IX86)
        #include "ovs-atomic-msvc.h"
#else
....

I will add the following line on top of the file to make it clear:
/* This header implements atomic operation primitives for MSVC
 * on x86 (32 bit). */

(I haven't tried building 64 bit builds to test otherwise. Visual
studio by default builds 32 build applications on 64 bit processors
too. It is a little work to make it build 64 bit applications.)



> I think that many of the macros should more carefully parenthesize
> their argument expansions.  Here are three examples but I see others:

I haven't used macros extensively before to understand the pitfalls well.
You mean, I should be doing this:
*(DST) = *(SRC);
instead of:
*DST = *SRC right?

I agree with all the other comments and will incorporate them.

Thanks!



More information about the dev mailing list