[threads] rw_lock question

Hello, I was looking at rw_lock implementation in the thread_dev branch and see that member variable m_num_waiting_promotion is only set in constructor to '0' and then once tested for equality with 1. So, looks like it has no effect at all? Did I miss anything? Note: I'm not yet planning to use rw_lock, I'm just looking at implementation. - Volodya

That's because lock promotion wasn't fully implemented in the original version of the library and was (apparently incompletely) removed from the version in cvs. For what it's worth, I have a version in which I have implemented lock promotion/demotion and made a number of other changes. Perhaps I should add this to the thread_dev branch of CVS to make it available for others to look at, and if any of the changes prove undesirable they can be backed out? As a warning, I should mention that I corresponded privately with William Kempf quite a long time ago about lock promotion and demotion, and he said:
That's a hot topic. I'm not sure the feature is really that useful since it will provide only a minor performance boost in comparison to simply unlocking and relocking with the new type. I'm hesitant to even look into this, since nearly every implementation that's been posted to the various groups has been proven to be incorrect, illustrating that this is a difficult thing to implement correctly (and once you do, is there any real performance increase?).
Having said that, I've been using all my changes for quite some time without problems. Mike "Vladimir Prus" <ghost@cs.msu.su> wrote in message news:200402181516.08991.ghost@cs.msu.su...
Hello, I was looking at rw_lock implementation in the thread_dev branch and
see that
member variable
m_num_waiting_promotion
is only set in constructor to '0' and then once tested for equality with 1. So, looks like it has no effect at all? Did I miss anything?
Note: I'm not yet planning to use rw_lock, I'm just looking at implementation.
- Volodya
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (2)
-
Michael Glassford
-
Vladimir Prus