- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We limited atomic
If we were to add support for more operations, I would be inclined to add some kind of template that allowed any STL unary function object to be used to specify an atomic update. E.g., x.apply( std::negate ) to atomically negate a location. Binders (20.3.6 in ISO C++ standard) could be used for creating useful unary functions from binary functions. It would be implemented using a compare-and-swap loop. We' have to restrict the argument type to a POD type that fits in an integer.
Perhaps such a template should not even be a member of class atomic, but a separate template algorithm.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's not available on x86 or Itanium. IBM's Power does atomic operations via a special load instruction followed by a later special conditional store, and so can emulate fetch-and-add for floating-point (and just about anything else). But in general, fetch-and-add for floating-point is not widely supported.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page