summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2002-11-08 05:03:02 +0000
committerMichi Henning <michi@zeroc.com>2002-11-08 05:03:02 +0000
commit90343381838a99ac9306ddecfc0edfc49c6d718c (patch)
tree72cf947d6b407e61d494c16a16326de35ff2f246 /cpp/src
parentChanged "adapter name" to "adapter id" (diff)
downloadice-90343381838a99ac9306ddecfc0edfc49c6d718c.tar.bz2
ice-90343381838a99ac9306ddecfc0edfc49c6d718c.tar.xz
ice-90343381838a99ac9306ddecfc0edfc49c6d718c.zip
Fixed incorrect writelock implementation -- the _writerControl member was
never set when a writer acquired the lock.
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/IceUtil/RWRecMutex.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/cpp/src/IceUtil/RWRecMutex.cpp b/cpp/src/IceUtil/RWRecMutex.cpp
index c466046b121..88899c5811d 100644
--- a/cpp/src/IceUtil/RWRecMutex.cpp
+++ b/cpp/src/IceUtil/RWRecMutex.cpp
@@ -86,6 +86,7 @@ IceUtil::RWRecMutex::timedTryReadlock(const Time& timeout) const
_count++;
}
+#include <iostream.h>
void
IceUtil::RWRecMutex::writelock() const
{
@@ -124,6 +125,7 @@ IceUtil::RWRecMutex::writelock() const
// Got the lock, indicate it's held by a writer.
//
_count = -1;
+ _writerControl = ThreadControl();
}
void
@@ -153,6 +155,7 @@ IceUtil::RWRecMutex::tryWritelock() const
// Got the lock, indicate it's held by a writer.
//
_count = -1;
+ _writerControl = ThreadControl();
}
void
@@ -163,7 +166,6 @@ IceUtil::RWRecMutex::timedTryWritelock(const Time& timeout) const
//
// If the mutex is already write locked by this writer then
// decrement _count, and return.
- //
if(_count < 0 && _writerControl == ThreadControl())
{
--_count;
@@ -202,6 +204,7 @@ IceUtil::RWRecMutex::timedTryWritelock(const Time& timeout) const
// Got the lock, indicate it's held by a writer.
//
_count = -1;
+ _writerControl = ThreadControl();
}
void
@@ -307,6 +310,7 @@ IceUtil::RWRecMutex::upgrade() const
// Got the lock, indicate it's held by a writer.
//
_count = -1;
+ _writerControl = ThreadControl();
}
void
@@ -356,4 +360,5 @@ IceUtil::RWRecMutex::timedUpgrade(const Time& timeout) const
// Got the lock, indicate it's held by a writer.
//
_count = -1;
+ _writerControl = ThreadControl();
}