diff options
author | Matthew Newhook <matthew@zeroc.com> | 2005-10-27 07:52:24 +0000 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2005-10-27 07:52:24 +0000 |
commit | 4fedcc1f6cba72946dbbd0688463aaa87b1e69ac (patch) | |
tree | 7d1b94230109412747d942f190824f984ad764b3 /cpp/test/IceUtil/thread/RWRecMutexTest.cpp | |
parent | http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=547 (diff) | |
download | ice-4fedcc1f6cba72946dbbd0688463aaa87b1e69ac.tar.bz2 ice-4fedcc1f6cba72946dbbd0688463aaa87b1e69ac.tar.xz ice-4fedcc1f6cba72946dbbd0688463aaa87b1e69ac.zip |
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=547
Diffstat (limited to 'cpp/test/IceUtil/thread/RWRecMutexTest.cpp')
-rw-r--r-- | cpp/test/IceUtil/thread/RWRecMutexTest.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/cpp/test/IceUtil/thread/RWRecMutexTest.cpp b/cpp/test/IceUtil/thread/RWRecMutexTest.cpp index 738d94d7d22..5c053e539c7 100644 --- a/cpp/test/IceUtil/thread/RWRecMutexTest.cpp +++ b/cpp/test/IceUtil/thread/RWRecMutexTest.cpp @@ -280,7 +280,7 @@ public: // // Acquire a read lock. // - RWRecMutex::TryRLock tlock(_m); + RWRecMutex::RLock tlock(_m); { Lock sync(*this); @@ -828,10 +828,8 @@ RWRecMutexTest::run() mutex.readLock(); RWRecMutexUpgradeThreadPtr t1 = new RWRecMutexUpgradeThread(mutex); - RWRecMutexWriteThreadPtr t2 = new RWRecMutexWriteThread(mutex); - + ThreadControl control1 = t1->start(); - ThreadControl control2 = t2->start(); // // Its not necessary to sleep here, since the upgrade thread @@ -839,7 +837,15 @@ RWRecMutexTest::run() // write thread cannot get the write lock. // t1->waitUpgrade(); +
+ RWRecMutexWriteThreadPtr t2 = new RWRecMutexWriteThread(mutex);
+ ThreadControl control2 = t2->start();
t2->waitWrite(); + //
+ // Its necessary to sleep for 1 second to ensure that the
+ // thread is actually IN the write lock and waiting.
+ //
+ ThreadControl::sleep(Time::seconds(1));
// // Unlocking the read mutex lets the upgrade continue. At this |