summaryrefslogtreecommitdiff
path: root/tests/Reader_Writer_Test.cpp
diff options
context:
space:
mode:
authormk1 <mk1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-06-17 23:58:44 +0000
committermk1 <mk1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-06-17 23:58:44 +0000
commit2147d9301d5c3388a05c9109ce8fe45e8399431a (patch)
tree25c63999566337b3b5e6e5628b46e90e1ddefad0 /tests/Reader_Writer_Test.cpp
parent7853b63ea92f5396e80194627924d4e9865ba6bd (diff)
downloadATCD-2147d9301d5c3388a05c9109ce8fe45e8399431a.tar.gz
minor
Diffstat (limited to 'tests/Reader_Writer_Test.cpp')
-rw-r--r--tests/Reader_Writer_Test.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/tests/Reader_Writer_Test.cpp b/tests/Reader_Writer_Test.cpp
index ca08048326a..20af7081659 100644
--- a/tests/Reader_Writer_Test.cpp
+++ b/tests/Reader_Writer_Test.cpp
@@ -191,12 +191,11 @@ writer (void *)
for (size_t iterations = 1; iterations <= n_iterations; iterations++)
{
ACE_OS::sleep(pause);
- {
- // Add an additional scope here to bound the duration that the
- // write lock is held.
- ACE_Write_Guard<ACE_RW_Thread_Mutex> g (rw_mutex);
- current_writers++;
+ ACE_Write_Guard<ACE_RW_Thread_Mutex> g (rw_mutex);
+
+ current_writers++;
+
if (current_writers > 1)
ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT (" (%t) other writers found!!!\n")));
@@ -204,11 +203,12 @@ writer (void *)
if (current_readers > 0)
ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT (" (%t) readers found!!!\n")));
- ACE_thread_t self = ACE_Thread::self ();
- shared_data = self;
+ ACE_thread_t self = ACE_Thread::self ();
- for (size_t loop = 1; loop <= n_loops; loop++)
+ shared_data = self;
+
+ for (size_t loop = 1; loop <= n_loops; loop++)
{
ACE_Thread::yield ();
@@ -217,11 +217,10 @@ writer (void *)
ASYS_TEXT (" (%t) somebody wrote on my data %d\n"),
shared_data));
}
- current_writers--;
- }
+ current_writers--;
+
ACE_DEBUG((LM_DEBUG, ASYS_TEXT (" (%t) write %d done at %T\n"), iterations));
- // ACE_Thread::yield ();
}
return 0;
}