- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
According to the documnetation, TBB atomic is supported for integer/enum types/pointer types.
I took at the test driver test_atomic.cpp and one of the test cases calls the function called
TestAtomicFloat. Does this imply that fetch_and_store, etc. will work correctly for
floats/doubles?
I took at the test driver test_atomic.cpp and one of the test cases calls the function called
TestAtomicFloat. Does this imply that fetch_and_store, etc. will work correctly for
floats/doubles?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, the documentation is just not up to date. Be careful when evaluating success for CAS (+0 and -0 are different for CAS but not for the equality operator, so using just the equality operator to compare the comparand with the return value instead of excluding -0 or using memcmp at least for the dubious cases you might erroneously evaluate a failed invocation as successful).
This is mentioned in tbb40_20120408oss/include/tbb/atomic.h: "Works for any type T that has the same size as an integral type, has a trivial constructor/destructor, and can be copied/compared by memcpy/memcmp."
(2012-05-21) Elaborated.
This is mentioned in tbb40_20120408oss/include/tbb/atomic.h: "Works for any type T that has the same size as an integral type, has a trivial constructor/destructor, and can be copied/compared by memcpy/memcmp."
(2012-05-21) Elaborated.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page