summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1998-10-17 00:27:24 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1998-10-17 00:27:24 +0000
commit0f5e8ff1b24c69e848ed49975f656ee28d387b90 (patch)
tree4991da893597e53d87f7fdf2d871986e444a4219
parent563c76e40583358b0e096c37cd374dbffe30393c (diff)
downloadATCD-0f5e8ff1b24c69e848ed49975f656ee28d387b90.tar.gz
.
-rw-r--r--tests/Hash_Map_Manager_Test.cpp28
-rw-r--r--tests/Map_Manager_Test.cpp42
-rw-r--r--tests/OrdMultiSet_Test.cpp56
-rw-r--r--tests/Upgradable_RW_Test.cpp187
4 files changed, 153 insertions, 160 deletions
diff --git a/tests/Hash_Map_Manager_Test.cpp b/tests/Hash_Map_Manager_Test.cpp
index 1fe095cdf83..b7aea0c075a 100644
--- a/tests/Hash_Map_Manager_Test.cpp
+++ b/tests/Hash_Map_Manager_Test.cpp
@@ -247,11 +247,15 @@ run_test (void)
for (HASH_STRING_ITER hash_iter (hash);
hash_iter.next (entry) != 0;
- hash_iter.advance (), i++)
- ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("iterating (%d): [%s, %s]\n"),
- i,
- (ASYS_TCHAR *) entry->ext_id_,
- (ASYS_TCHAR *) entry->int_id_));
+ hash_iter.advance ())
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ASYS_TEXT ("iterating (%d): [%s, %s]\n"),
+ i,
+ (ASYS_TCHAR *) entry->ext_id_,
+ (ASYS_TCHAR *) entry->int_id_));
+ i++;
+ }
}
hash.unbind (string_table[2].key_, entry);
@@ -276,11 +280,15 @@ run_test (void)
for (HASH_STRING_REVERSE_ITER hash_iter (hash);
hash_iter.next (entry) != 0;
- hash_iter.advance (), i++)
- ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("iterating (%d): [%s, %s]\n"),
- i,
- (ASYS_TCHAR *) entry->ext_id_,
- (ASYS_TCHAR *) entry->int_id_));
+ hash_iter.advance ())
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ASYS_TEXT ("iterating (%d): [%s, %s]\n"),
+ i,
+ (ASYS_TCHAR *) entry->ext_id_,
+ (ASYS_TCHAR *) entry->int_id_));
+ i++;
+ }
}
alloc.dump ();
diff --git a/tests/Map_Manager_Test.cpp b/tests/Map_Manager_Test.cpp
index 82ff318c398..874a6226d2b 100644
--- a/tests/Map_Manager_Test.cpp
+++ b/tests/Map_Manager_Test.cpp
@@ -81,7 +81,7 @@ test_hash_map_manager (size_t table_size, size_t iterations)
for (HASH_ITERATOR iter = map.begin ();
iter != end;
- iter++)
+ ++iter)
{
HASH_ENTRY &entry = *iter;
ACE_DEBUG ((LM_DEBUG,
@@ -89,7 +89,7 @@ test_hash_map_manager (size_t table_size, size_t iterations)
i,
entry.ext_id_,
entry.int_id_));
- i++;
+ ++i;
}
ACE_DEBUG ((LM_DEBUG,
@@ -111,7 +111,7 @@ test_hash_map_manager (size_t table_size, size_t iterations)
i,
entry->ext_id_,
entry->int_id_));
- i++;
+ ++i;
}
ACE_DEBUG ((LM_DEBUG,
@@ -126,7 +126,7 @@ test_hash_map_manager (size_t table_size, size_t iterations)
for (HASH_REVERSE_ITERATOR iter = map.rbegin ();
iter != rend;
- iter++)
+ ++iter)
{
HASH_ENTRY &entry = *iter;
ACE_DEBUG ((LM_DEBUG,
@@ -168,7 +168,7 @@ test_hash_map_manager (size_t table_size, size_t iterations)
HASH_MAP_MANAGER::iterator end = map.end ();
for (HASH_MAP_MANAGER::iterator iter = map.begin ();
iter != end;
- iter++)
+ ++iter)
{
HASH_MAP_MANAGER::ENTRY &entry = *iter;
ACE_DEBUG ((LM_DEBUG,
@@ -176,7 +176,7 @@ test_hash_map_manager (size_t table_size, size_t iterations)
i,
entry.ext_id_,
entry.int_id_));
- i++;
+ ++i;
}
ACE_DEBUG ((LM_DEBUG,
@@ -196,7 +196,7 @@ test_hash_map_manager (size_t table_size, size_t iterations)
i,
entry->ext_id_,
entry->int_id_));
- i++;
+ ++i;
}
ACE_DEBUG ((LM_DEBUG,
@@ -211,7 +211,7 @@ test_hash_map_manager (size_t table_size, size_t iterations)
for (HASH_MAP_MANAGER::reverse_iterator iter = map.rbegin ();
iter != rend;
- iter++)
+ ++iter)
{
HASH_MAP_MANAGER::ENTRY &entry = *iter;
ACE_UNUSED_ARG (entry);
@@ -247,13 +247,13 @@ test_hash_map_manager (size_t table_size, size_t iterations)
ACE_ASSERT (k == -1);
}
- for (i = 0; i < iterations; i++)
+ for (i = 0; i < iterations; ++i)
{
ACE_ASSERT (map.find (i, j) != -1);
ACE_ASSERT (i == j);
}
- for (i = 0; i < iterations; i++)
+ for (i = 0; i < iterations; ++i)
ACE_ASSERT (map.unbind (i) != -1);
ACE_ASSERT (map.current_size () == 0);
@@ -267,7 +267,7 @@ test_map_manager (size_t table_size, size_t iterations)
TYPE j;
ssize_t k;
- for (i = 0; i < iterations; i++)
+ for (i = 0; i < iterations; ++i)
ACE_ASSERT (map.bind (i, i) != -1);
{
@@ -276,7 +276,7 @@ test_map_manager (size_t table_size, size_t iterations)
ITERATOR end = map.end ();
for (ITERATOR iter = map.begin ();
iter != end;
- iter ++)
+ ++iter)
{
ENTRY &entry = *iter;
ACE_DEBUG ((LM_DEBUG,
@@ -284,7 +284,7 @@ test_map_manager (size_t table_size, size_t iterations)
i,
entry.ext_id_,
entry.int_id_));
- i++;
+ ++i;
}
ACE_DEBUG ((LM_DEBUG,
@@ -303,7 +303,7 @@ test_map_manager (size_t table_size, size_t iterations)
i,
entry->ext_id_,
entry->int_id_));
- i++;
+ ++i;
}
ACE_DEBUG ((LM_DEBUG,
@@ -318,7 +318,7 @@ test_map_manager (size_t table_size, size_t iterations)
for (REVERSE_ITERATOR iter = map.rbegin ();
iter != rend;
- iter++)
+ ++iter)
{
entry = *iter;
ACE_DEBUG ((LM_DEBUG,
@@ -358,13 +358,13 @@ test_map_manager (size_t table_size, size_t iterations)
MAP_MANAGER::iterator end = map.end ();
for (MAP_MANAGER::iterator iter = map.begin ();
iter != end;
- iter++)
+ ++iter)
{
entry = *iter;
ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("%u "),
entry.int_id_));
- i++;
+ ++i;
}
ACE_DEBUG ((LM_DEBUG,
@@ -384,7 +384,7 @@ test_map_manager (size_t table_size, size_t iterations)
i,
entry->ext_id_,
entry->int_id_));
- i++;
+ ++i;
}
ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("\n")));
@@ -398,7 +398,7 @@ test_map_manager (size_t table_size, size_t iterations)
for (MAP_MANAGER::reverse_iterator iter = map.rbegin ();
iter != rend;
- iter++)
+ ++iter)
{
entry = *iter;
ACE_DEBUG ((LM_DEBUG,
@@ -431,13 +431,13 @@ test_map_manager (size_t table_size, size_t iterations)
ACE_ASSERT (k == -1);
}
- for (i = 0; i < iterations; i++)
+ for (i = 0; i < iterations; ++i)
{
ACE_ASSERT (map.find (i, j) != -1);
ACE_ASSERT (i == j);
}
- for (i = 0; i < iterations; i++)
+ for (i = 0; i < iterations; ++i)
ACE_ASSERT (map.unbind (i) != -1);
ACE_ASSERT (map.current_size () == 0);
diff --git a/tests/OrdMultiSet_Test.cpp b/tests/OrdMultiSet_Test.cpp
index 5773bc29ec5..86bc85a3090 100644
--- a/tests/OrdMultiSet_Test.cpp
+++ b/tests/OrdMultiSet_Test.cpp
@@ -48,19 +48,20 @@ main (int, ASYS_TCHAR *[])
for (i = -10; i < 10; ++i)
set.insert (2 * i + 1);
- // put in an interleaved range of even ints, using an iterator
+ // Put in an interleaved range of even ints, using an iterator.
for (i = -10; i <= 10; ++i)
set.insert (2 * i, iter);
- // remove the first and last elements of range
+ // Remove the first and last elements of range.
while (set.remove (-20) == 0);
while (set.remove (20) == 0);
- // should still have 39 elements in the set
+ // Should still have 39 elements in the set.
ACE_ASSERT (set.is_empty () == 0);
ACE_ASSERT (set.size () == 39);
- // iterate forward through the range we created: should be one of each
+ // Iterate forward through the range we created: should be one of
+ // each.
iter.first ();
for (i = -19; i <= 19; ++i)
{
@@ -76,33 +77,34 @@ main (int, ASYS_TCHAR *[])
iter.advance ();
}
- // we should have iterated through the entire set
+ // We should have iterated through the entire set.
ACE_ASSERT (iter.done () != 0);
- // iterate backward through the range we created: should be one of each
+ // Iterate backward through the range we created: should be one of
+ // each.
iter.last ();
for (i = 19; i >= -19; --i)
{
- // we should still be in the set
+ // We should still be in the set.
ACE_ASSERT (iter.done () == 0);
- // make sure the current element is what we expect
+ // Make sure the current element is what we expect.
int *ptr;
iter.next (ptr);
ACE_ASSERT (ptr != 0);
ACE_ASSERT (*ptr == i);
- // move to the previous element in the set
+ // Move to the previous element in the set.
iter.retreat ();
}
- // we should have iterated through the entire set
+ // We should have iterated through the entire set.
ACE_ASSERT (iter.done () != 0);
- // clear the set, restart the iterator, and make sure
- // the iterator is out of range at both ends, the set is empty,
- // and a subsequent advance or retreat on an out of range iterator
- // does not cause problems
+ // Clear the set, restart the iterator, and make sure the iterator
+ // is out of range at both ends, the set is empty, and a subsequent
+ // advance or retreat on an out of range iterator does not cause
+ // problems
set.reset ();
ACE_ASSERT (set.is_empty () != 0);
iter.first ();
@@ -112,8 +114,8 @@ main (int, ASYS_TCHAR *[])
ACE_ASSERT (iter.done () != 0);
iter.advance ();
- // put in a bunch of ints in various relative positions,
- // using an iterator for the odds and no iterator for the evens
+ // Put in a bunch of ints in various relative positions, using an
+ // iterator for the odds and no iterator for the evens.
set.insert (203, iter);
set.insert (202);
set.insert (204);
@@ -137,8 +139,8 @@ main (int, ASYS_TCHAR *[])
while (set.remove (202) == 0);
while (set.remove (203) == 0);
- // put the iterator out of range and make sure it stays
- // that way for finds on the missing elements
+ // Put the iterator out of range and make sure it stays
+ // that way for finds on the missing elements.
iter.last ();
iter.advance ();
set.find (203, iter);
@@ -148,7 +150,7 @@ main (int, ASYS_TCHAR *[])
set.find (204, iter);
ACE_ASSERT (iter.done () != 0);
- // make sure the other elements can be found
+ // Make sure the other elements can be found.
set.find (205, iter);
ACE_ASSERT (iter.done () == 0);
iter.next (ptr);
@@ -160,34 +162,36 @@ main (int, ASYS_TCHAR *[])
ACE_ASSERT (ptr != 0);
ACE_ASSERT (*ptr == 201);
- // finally, iterate through the set and make sure its
- // contents are correct (one 201 and five 205s)
+ // Finally, iterate through the set and make sure its contents are
+ // correct (one 201 and five 205s).
iter.first ();
ACE_ASSERT (iter.done () == 0);
iter.next (ptr);
ACE_ASSERT (ptr != 0);
ACE_ASSERT (*ptr == 201);
iter.advance ();
+
for (i = 1; i <= 5; ++i)
{
- // should be in the set, able to access the element, value should be 205
+ // Should be in the set, able to access the element, value
+ // should be 205
ACE_ASSERT (iter.done () == 0);
iter.next (ptr);
ACE_ASSERT (ptr != 0);
ACE_ASSERT (*ptr == 205);
- // move to the next element in the set
+ // Move to the next element in the set.
iter.advance ();
}
- // should not be anything else in the set
+ // Should not be anything else in the set.
ACE_ASSERT (iter.done () != 0);
// remove the rest
while (set.remove (205) == 0);
while (set.remove (201) == 0);
- // should have no more elements in the set
+ // Should have no more elements in the set.
ACE_ASSERT (set.is_empty () != 0);
ACE_ASSERT (set.size () == 0);
iter.first ();
@@ -195,13 +199,11 @@ main (int, ASYS_TCHAR *[])
iter.last ();
ACE_ASSERT (iter.done () != 0);
-
ACE_END_TEST;
return ret;
}
-
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Ordered_MultiSet<int>;
diff --git a/tests/Upgradable_RW_Test.cpp b/tests/Upgradable_RW_Test.cpp
index fca68c2cb6d..741b30fe145 100644
--- a/tests/Upgradable_RW_Test.cpp
+++ b/tests/Upgradable_RW_Test.cpp
@@ -11,9 +11,8 @@
// = DESCRIPTION
// This test program verifies the functionality of the ACE_OS
// implementation of readers/writer locks on Win32 and Posix
-// pthreads.
-// Use the RW_Mutex define switch to use readers/writer mutexes or
-// regular mutexes.
+// pthreads. Use the RW_Mutex define switch to use
+// readers/writer mutexes or regular mutexes.
//
// = AUTHOR
// Michael Kircher <mk1@cs.wustl.edu>
@@ -35,7 +34,7 @@ ACE_RCSID(tests, Upgradable_RW_Test, "$Id$")
static size_t n_iterations = 50;
// Maximum string length used
-#define MAX_STRING_SIZE 200
+static const MAX_STRING_SIZE = 200;
// switch on RW mutexes, else use ordinary mutexes
// #define RW_MUTEX 1
@@ -50,53 +49,52 @@ static size_t n_writers = 0;
static u_int n_entries = 10;
// Try to upgrade to a write lock, by default don't try.
-static unsigned long use_try_upgrade = 0;
+static u_long use_try_upgrade = 0;
// number of readers, which were able to upgrade
-static unsigned long upgraded = 0;
+static u_long upgraded = 0;
// count the number of find calls
-static unsigned long find_called = 0;
+static u_long find_called = 0;
// number of readers, failing or not allowed to upgrade
static u_int not_upgraded = 0;
// Lock for shared_data (upgraded, not_upgraded, hash_Map)
-#if defined RW_MUTEX
+#if defined (RW_MUTEX)
static ACE_RW_Thread_Mutex rw_mutex;
#else
static ACE_Thread_Mutex mutex;
-#endif
+#endif /* RW_MUTEX */
// Count of the number of readers and writers.
static ACE_Atomic_Op<ACE_Thread_Mutex, int> current_readers;
static ACE_Atomic_Op<ACE_Thread_Mutex, int> current_writers;
-Linked_List *linked_List_ptr;
-
-
-
-
+static Linked_List *linked_list_ptr;
// Returns 1 if found,
// 0 if not found,
// -1 on an error
static int
-find_last ()
+find_last (void)
{
find_called++;
char search_string[MAX_STRING_SIZE];
- ACE_OS::sprintf(search_string,"%d",n_entries-1);
+ ACE_OS::sprintf (search_string,
+ "%d",
+ n_entries - 1);
ACE_CString cString (search_string);
Element* element_ptr;
- for (ACE_Double_Linked_List_Iterator<Element> iterator(*linked_List_ptr);
- !iterator.done();
- iterator.advance())
+ for (ACE_Double_Linked_List_Iterator<Element> iterator (*linked_list_ptr);
+ !iterator.done ();
+ iterator.advance ())
{
- if ((element_ptr = iterator.next()))
- if (*element_ptr->value() == cString)
+ element_ptr = iterator.next ();
+ if (element_ptr)
+ if (*element_ptr->value () == cString)
return 1;
}
@@ -149,19 +147,17 @@ parse_args (int argc, ASYS_TCHAR *argv[])
// while we have a read lock.
int
-Reader_Task::svc ()
+Reader_Task::svc (void)
{
ACE_Profile_Timer timer;
ACE_Profile_Timer::ACE_Elapsed_Time elapsed_time;
- barrier_.wait();
- // wait at the barrier
-
+ barrier_.wait ();
+ // Wait at the barrier.
// We start an ACE_Profile_Timer here...
timer.start ();
-
for (size_t iterations = 1;
iterations <= n_iterations;
iterations++)
@@ -171,51 +167,44 @@ Reader_Task::svc ()
int result = 0;
{
-#if defined RW_MUTEX
+#if defined (RW_MUTEX)
ACE_Read_Guard<ACE_RW_Thread_Mutex> g (rw_mutex);
#else
ACE_Guard<ACE_Thread_Mutex> g (mutex);
-#endif
-
+#endif /* RW_MUTEX */
find_last ();
-
-#if defined RW_MUTEX
+#if defined (RW_MUTEX)
if (use_try_upgrade)
- result = rw_mutex.tryacquire_write_upgrade ();
-#endif
+ result =
+ rw_mutex.tryacquire_write_upgrade ();
+#endif /* RW_MUTEX */
// True, when we were able to upgrade.
if (result == 0 && use_try_upgrade)
{
- //find_last ();
- // try to find something which is not in there
+ //find_last (); try to find something which is not in
+ //there
upgraded++;
-
continue;
}
}
-
- if ((result == -1 && errno == EBUSY) // we tried and failed
- || !use_try_upgrade) // we did not try at all
+ if (result == -1 && errno == EBUSY // we tried and failed
+ || !use_try_upgrade) // we did not try at all
{
-#if defined RW_MUTEX
+#if defined (RW_MUTEX)
ACE_Write_Guard<ACE_RW_Thread_Mutex> g (rw_mutex);
#else
ACE_Guard<ACE_Thread_Mutex> g (mutex);
-#endif
+#endif /* RW_MUTEX */
not_upgraded++;
-
find_last ();
-
}
else if (result == -1 && errno != EBUSY)
- {
- ACE_ERROR ((LM_ERROR,
- ASYS_TEXT ("(%t) failure in upgrading to write lock!\n"),
- 1));
- }
+ ACE_ERROR ((LM_ERROR,
+ ASYS_TEXT (" (%t) failure in upgrading to write lock!\n"),
+ 1));
}
// Stop the timer.
@@ -231,13 +220,13 @@ Reader_Task::svc ()
// checking that nobody steps on it while we can write it.
int
-Writer_Task::svc ()
+Writer_Task::svc (void)
{
ACE_Profile_Timer timer;
ACE_Profile_Timer::ACE_Elapsed_Time elapsed_time;
- barrier_.wait();
- // wait at the barrier
+ barrier_.wait ();
+ // Wait at the barrier
// We start an ACE_Profile_Timer here...
timer.start ();
@@ -248,18 +237,17 @@ Writer_Task::svc ()
{
ACE_Thread::yield ();
-#if defined RW_MUTEX
+#if defined (RW_MUTEX)
ACE_Write_Guard<ACE_RW_Thread_Mutex> g (rw_mutex);
#else
ACE_Guard<ACE_Thread_Mutex> g (mutex);
-#endif
+#endif /* RW_MUTEX */
find_last ();
current_writers--;
}
-
// Stop the timer.
timer.stop ();
timer.elapsed_time (elapsed_time);
@@ -282,10 +270,10 @@ Time_Calculation::report_time (ACE_Profile_Timer::ACE_Elapsed_Time &elapsed_time
}
void
-Time_Calculation ::print_stats ()
+Time_Calculation ::print_stats (void)
{
ACE_Profile_Timer::ACE_Elapsed_Time elapsed_time = this->times_;
- unsigned int iterations = 1;
+ u_int iterations = 1;
if (iterations > 0)
{
@@ -299,11 +287,12 @@ Time_Calculation ::print_stats ()
double tmp = 1000 / elapsed_time.real_time;
- ACE_DEBUG ((LM_DEBUG,ASYS_TEXT ("\n"
- "\treal_time\t = %0.06f ms, \n"
- "\tuser_time\t = %0.06f ms, \n"
- "\tsystem_time\t = %0.06f ms, \n"
- "\t%0.00f calls/second\n"),
+ ACE_DEBUG ((LM_DEBUG,
+ ASYS_TEXT ("\n"
+ "\treal_time\t = %0.06f ms, \n"
+ "\tuser_time\t = %0.06f ms, \n"
+ "\tsystem_time\t = %0.06f ms, \n"
+ "\t%0.00f calls/second\n"),
elapsed_time.real_time < 0.0 ? 0.0 : elapsed_time.real_time,
elapsed_time.user_time < 0.0 ? 0.0 : elapsed_time.user_time,
elapsed_time.system_time < 0.0 ? 0.0 : elapsed_time.system_time,
@@ -312,32 +301,33 @@ Time_Calculation ::print_stats ()
ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("Number of reported times: %d\n"),
this->reported_times_));
-
}
else
ACE_ERROR ((LM_ERROR,
"\tNo time stats printed. Zero iterations or error ocurred.\n"));
}
-
-int
-init ()
+static int
+init (void)
{
char entry[MAX_STRING_SIZE];
- ACE_CString* cString_ptr;
- Element* element_ptr;
+ ACE_CString *cString_ptr;
+ Element *element_ptr;
- ACE_NEW_RETURN (linked_List_ptr,
+ ACE_NEW_RETURN (linked_list_ptr,
Linked_List,
-1);
- for (unsigned long i = 0; i < n_entries; i++)
+ for (u_long i = 0; i < n_entries; i++)
{
- ACE_OS::sprintf(entry,"%d",i);
- ACE_NEW_RETURN (cString_ptr, ACE_CString(entry), -1);
- ACE_NEW_RETURN (element_ptr, Element(cString_ptr), -1);
-
- linked_List_ptr->insert_tail(element_ptr);
+ ACE_OS::sprintf (entry, "%d", i);
+ ACE_NEW_RETURN (cString_ptr,
+ ACE_CString (entry),
+ -1);
+ ACE_NEW_RETURN (element_ptr,
+ Element (cString_ptr),
+ -1);
+ linked_list_ptr->insert_tail (element_ptr);
}
return 0;
}
@@ -364,14 +354,11 @@ main (int argc, ASYS_TCHAR *argv[])
ACE_START_TEST (ASYS_TEXT ("Upgradable_RW_Test"));
#if defined (ACE_HAS_THREADS)
-
parse_args (argc, argv);
-
-#if !defined RW_MUTEX
+#if !defined (RW_MUTEX)
use_try_upgrade = 0;
// make sure that we have to acquire the write lock
-#endif
-
+#endif /* RW_MUTEX */
current_readers = 0; // Possibly already done
current_writers = 0; // Possibly already done
@@ -379,7 +366,7 @@ main (int argc, ASYS_TCHAR *argv[])
init ();
ACE_DEBUG ((LM_DEBUG,
- ASYS_TEXT ("(%t) main thread starting\n")));
+ ASYS_TEXT (" (%t) main thread starting\n")));
Time_Calculation time_Calculation;
// for the time calculation
@@ -387,21 +374,20 @@ main (int argc, ASYS_TCHAR *argv[])
ACE_Barrier barrier (n_readers + n_writers);
// for a nice start of all threads (for much contention)
- // Initialize the readers
+ // Initialize the readers.
Reader_Task** reader_tasks;
ACE_NEW_RETURN (reader_tasks,
Reader_Task*[n_readers],
-1);
-
- unsigned int i;
+ u_int i;
for (i = 0;
i < n_readers;
i++)
{
ACE_NEW_RETURN (reader_tasks[i],
- Reader_Task(time_Calculation,
+ Reader_Task (time_Calculation,
barrier),
-1);
reader_tasks[i]->activate (THR_BOUND | ACE_SCHED_FIFO,
@@ -410,7 +396,6 @@ main (int argc, ASYS_TCHAR *argv[])
ACE_DEFAULT_THREAD_PRIORITY);
}
-
// Create all the writers
Writer_Task** writer_tasks;
@@ -418,13 +403,12 @@ main (int argc, ASYS_TCHAR *argv[])
Writer_Task*[n_writers],
-1);
-
for (i = 0;
i < n_writers;
i++)
{
ACE_NEW_RETURN (writer_tasks[i],
- Writer_Task(time_Calculation,
+ Writer_Task (time_Calculation,
barrier),
-1);
writer_tasks[i]->activate (THR_BOUND | ACE_SCHED_FIFO,
@@ -441,7 +425,7 @@ main (int argc, ASYS_TCHAR *argv[])
if (not_upgraded != 0 || upgraded != 0)
ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("upgraded to not upgraded ratio = %f \n"),
- (float) upgraded/ (float) (not_upgraded + upgraded)));
+ (float) upgraded / (float) (not_upgraded + upgraded)));
ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("Number of times, that find was called: %d\n"),
@@ -449,40 +433,39 @@ main (int argc, ASYS_TCHAR *argv[])
ACE_DEBUG ((LM_DEBUG,
- ASYS_TEXT ("(%t) exiting main thread\n")));
+ ASYS_TEXT (" (%t) exiting main thread\n")));
+
+ // Delete the memory of the Double_Linked_List
+ ACE_CString *cString_ptr;
+ Element *element_ptr;
- // delete the memory of the Double_Linked_List
- ACE_CString* cString_ptr;
- Element* element_ptr;
for (i = 0;
i < n_entries;
i++)
{
- if ((element_ptr = linked_List_ptr->delete_head()))
+ if ((element_ptr = linked_list_ptr->delete_head ()))
{
- cString_ptr = element_ptr->value();
+ cString_ptr = element_ptr->value ();
delete cString_ptr;
delete element_ptr;
}
}
- delete linked_List_ptr;
+
+ delete linked_list_ptr;
for (i = 0;
i < n_writers;
i++)
- {
- delete writer_tasks[i];
- }
+ delete writer_tasks[i];
+
delete [] writer_tasks;
for (i = 0;
i < n_readers;
i++)
- {
- delete reader_tasks [i];
- }
- delete [] reader_tasks;
+ delete reader_tasks [i];
+ delete [] reader_tasks;
#else
ACE_UNUSED_ARG (argc);
ACE_UNUSED_ARG (argv);