
Peter Dimov wrote:
Yuval Ronen wrote:
Peter Dimov wrote:
Hello everyone,
I'd like to start working on a Boost implementation of my threading proposal N2178:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2178.html Just some naming comments, if I may:
It seems to me the word "lock" is used with different meanings. For example, there's a "rwlock" and the scoped wrappers for it are "read_lock" and "write_lock". Very confusing, IMO. I think the word "lock" should either be used for the synchronization classes, or for the scoped wrappers, but not both.
I've consistently used the POSIX names. I agree that it's unfortunate that they used mutex and rwlock for the two primitives.
Indeed unfortunate... But maybe there's no real need to follow the POSIX name so rigidly for the C++ classes?
The word "scoped" appears only for mutex's scoped_lock, although read_lock and write_lock are also scoped. My opinion is that this word should either be part of the names of all the scoped wrappers or none of them, in a uniform manner.
I tried the "none of them" approach, calling scoped_lock just lock, but it turned out to not work well in practice since it's better to reserve 'lock' for the variable name. I could've gone with Howard's exclusive_lock, but it's a bit too lengthy and hard to type for repeated use.
So maybe we should go for the "all of them" approach? scoped_mutex, scoped_rlock, scoped_wlock?