A new WG21 paper is available. A copy is linked below, and the paper will also appear in the next normal WG21 mailing. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.
Document number: N4033
Date: 2014-05-23
synchronized_valuefor associating a mutex with a value by Anthony Williams
Excerpt:
A couple of years ago I wrote an article for Dr Dobb's Journal discussing a
synchronized_valuetemplate to associate a mutex with a value. I'd like to propose that template for standardization, with a few modifications.The basic idea is that
synchronized_value<T>stores a value of typeTand amutex. It then exposes a pointer interface, such that derefencing the pointer yields a special wrapper type that holds a lock on the mutex, and that can be implicitly converted toTfor reading, and which forwards any values assigned to the assignment operator of the underlyingTfor writing. There is also an arrow operator which allows member functions on the wrapped value to be called...

Add a Comment
Comments are closed.