[SERVER-30706] Create specializations of AtomicWord<T> that are lock-free for eligible user define dtypes Created: 16/Aug/17  Updated: 30/Oct/23  Resolved: 21/Aug/17

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 3.5.12

Type: Task Priority: Major - P3
Reporter: Andy Schwerin Assignee: Mira Carey
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Platforms 2017-09-11
Participants:

 Description   

AtomicWord<T> is implemented in terms of std::atomic<T>. However, until C++17, there is no way to determine at compile time if std::atomic<T> has a lock-free implementation. This task is to provide a specialization of AtomicWord<T> for user-defined types T that is definitely lock free when the correspondingly sized integer type's atomic is also lock free.

It should be a compile-time error to create an AtomicWord<T> for a user-defined type whose implementation would otherwise require locks. As part of this task, the implementer should also write runtime tests that confirm that the AtomicWord instantiations for integer types are actually lock free by using std::atomic::is_lock_free().



 Comments   
Comment by Githook User [ 21/Aug/17 ]

Author:

{'username': 'hanumantmk', 'email': 'jcarey@argv.me', 'name': 'Jason Carey'}

Message: SERVER-30706 Support for non-int AtomicWord<T>

Restricts the base AtomicWord template to integral types and adds
another specialization which uses a std::atomic<uint64_t> for
non-integral types (by doing atomic 64 bit ops, then copying bytes in
and out of the user type assuming it's Trivially copyable).
Branch: master
https://github.com/mongodb/mongo/commit/0fe978629f685f19e93ebc16ea2f311590850220

Generated at Thu Feb 08 04:24:44 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.