Search code examples
c++boostatomic

boost::atomic compile issues


I know that boost::atomic isn't an official part of the boost library, but I've seen it referred to a number of times on stackoverflow, so thought I'd give it a go. I should prefice this post by saying that I have searched google, stackoverflow and the documentation for boost::atomic before posting this.

I downloaded boost::atomic from http://www.chaoticmind.net/~hcb/projects/boost.atomic/ and copied it into my boost folder. However, I'm having issues with it actually compiling after being included and I think there's an error in the code. One of the functions that is causing issues is this

static inline void
                platform_fence_after_load(memory_order)
            {
                if (order == memory_order_seq_cst()) {
                    x86_full_fence(void);
                }
            }

The first issue is that order isn't defined, memory_order_seq_cst isn't a function and x86_full_fence shouldn't have void as a parameter. It's easy enough to fix those errors, but I'm not sure if they're a symptom of something else. Has anyone here used boost::atomic before? Is it stable, and does it work correctly? Finally, are these actually issues with boost::atomic or am I simply not using it correctly? Any help would be appreciated.


Solution

  • I have used it for a long time it is quite stable but it have some problems in header interlocked.hpp, one of issues is addressed by you and it is quite easy to solve it and other is one function is not declared as inline, so it will generate a linker error, but after solving them AFAIK it really work without any problem