T
Tryion
Hi,
I'd like to know if it's possible/responsible to use the ReaderWriterLock
class (RWL) in a class without declaring it as "static". The example in the
SDK does not use a static RWL. However, the documentation has the standard
disclaimer of "Any public static members of this type are safe for
multithreaded operations. Any instance members are not guaranteed to be
thread safe." And the members of this class are not static, so all of
ReaderWriterLock methods are unsafe for multithreaded operations? Seems
like RWL is not terribly useful! Should I assume the docs are wrong?
I can make the instance of the RWL class static in the class containing it,
which I believe will have approx. the same effect as making the methods
static (at least for operations between the instances of the containing
class)? Moreover, the example at (
http://msdn.microsoft.com/library/d...SystemThreadingReaderWriterLockClassTopic.asp )
, it indicates that declaring the ReaderWriterLock static makes it visible
to all threads. Which implies it's not visible if it's not static? <blink,
blink>
Any insight into the behavior of RWL would be helpful - any links to
articles, ect. would be much appreciated. I've found a few articles on the
subject, but none go into enough detail into the inner workings of RWL to be
of much help. I'm thoroughly confused.
Regards,
Tyrion
I'd like to know if it's possible/responsible to use the ReaderWriterLock
class (RWL) in a class without declaring it as "static". The example in the
SDK does not use a static RWL. However, the documentation has the standard
disclaimer of "Any public static members of this type are safe for
multithreaded operations. Any instance members are not guaranteed to be
thread safe." And the members of this class are not static, so all of
ReaderWriterLock methods are unsafe for multithreaded operations? Seems
like RWL is not terribly useful! Should I assume the docs are wrong?
I can make the instance of the RWL class static in the class containing it,
which I believe will have approx. the same effect as making the methods
static (at least for operations between the instances of the containing
class)? Moreover, the example at (
http://msdn.microsoft.com/library/d...SystemThreadingReaderWriterLockClassTopic.asp )
, it indicates that declaring the ReaderWriterLock static makes it visible
to all threads. Which implies it's not visible if it's not static? <blink,
blink>
Any insight into the behavior of RWL would be helpful - any links to
articles, ect. would be much appreciated. I've found a few articles on the
subject, but none go into enough detail into the inner workings of RWL to be
of much help. I'm thoroughly confused.
Regards,
Tyrion