|
Boost Users : |
Subject: Re: [Boost-users] circular buffer in a multithreaded program
From: Lee Clagett (forum_at_[hidden])
Date: 2014-04-24 07:59:19
>
> I also programmed in Java. From what I can tell, there is little
> difference between Java and C++ in this regard. The terminology is
> just different. What you call "monitor", "volatile" and "happens
> before" in Java is called "mutex", "amotic" and "sequenced before". On
> top of that C++11 allows you to use "weaker synchronization". But
> that's something I choose to ignore because it's just too easy to get
> it wrong and not worth the performance gain in my opinion.
>
> Cheers!
> Sebastian
>
>
Volatile in C/C++ is not sequenced like atomics in Java. In many cases the
observed behavior on x86 platforms will be similar, but this is by chance.
C++11 and boost have std/boost::atomic, which will match the behavior of
Java atomics. C++11 and boost also have a std/boost::mutex implementation.
Lee
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net