diff options
author | poberlin <poberlin@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-07-30 02:08:08 +0000 |
---|---|---|
committer | poberlin <poberlin@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-07-30 02:08:08 +0000 |
commit | 63129e5604a53185335752de301f51ad79c6bd5e (patch) | |
tree | cef2c95b99489fe7f9786fd8692936ad341dc31c | |
parent | 094071160db60f18ec07fba8fd3ca3bb4a10860b (diff) | |
download | ATCD-63129e5604a53185335752de301f51ad79c6bd5e.tar.gz |
updates
-rw-r--r-- | ACE/ace/Live_P_Strategy.inl | 9 | ||||
-rw-r--r-- | ACE/tests/DA_Reactor_Test.cpp | 10 |
2 files changed, 15 insertions, 4 deletions
diff --git a/ACE/ace/Live_P_Strategy.inl b/ACE/ace/Live_P_Strategy.inl index 7de17dd2eee..7e56f69991a 100644 --- a/ACE/ace/Live_P_Strategy.inl +++ b/ACE/ace/Live_P_Strategy.inl @@ -19,6 +19,8 @@ struct AnnotationNode { int larger_right; }; + + class Live_P_Tree : public ACE_RB_Tree<int, AnnotationNode, ACE_Equal_To<int>, ACE_Thread_Mutex> { public: @@ -34,9 +36,12 @@ private: void recalculate_augmentation(ACE_RB_Tree_Node<int, AnnotationNode>* nodePtr); void recalculate_augmentation_up(ACE_RB_Tree_Node<int, AnnotationNode>* x); int calc_max_i(ACE_RB_Tree_Node<int, AnnotationNode>* nodePtr, int extra) const; - //static int MIN(int a, int b) { return (a<b)?a:b; } + static int MIN(int a, int b) + { + return (a < b)? a : b; + } static int MIN_THREE(int a, int b, int c) { - return (a<b)?MIN(a,c):MIN(b,c); + return (a < b)? Live_P_Tree::MIN(a,c): Live_P_Tree::MIN(b,c); } int T_; }; diff --git a/ACE/tests/DA_Reactor_Test.cpp b/ACE/tests/DA_Reactor_Test.cpp index 3d109483f0a..c943305f277 100644 --- a/ACE/tests/DA_Reactor_Test.cpp +++ b/ACE/tests/DA_Reactor_Test.cpp @@ -64,6 +64,9 @@ #include "ace/Live_P_Strategy.h" #include "ace/k_Efficient_P_Strategy.h" +#include <ctime> +#include <cstdlib> + ACE_RCSID(TPReactor, TPReactor_Test, "TPReactor_Test.cpp,v 1.27 2000/03/07 17:15:56 schmidt Exp") // Some debug helper functions @@ -437,7 +440,8 @@ Receiver::open (void *) if (ACE_Reactor::instance()->register_handler (this, flg_mask_) == -1) return -1; - ACE_Deadlock_Free_TP_Reactor::instance()->add_annotation(this, 1); + //randomize annotation between 1 and 10 + ACE_Deadlock_Free_TP_Reactor::instance()->add_annotation(this, (rand()%9) + 1); initiate_io (ACE_Event_Handler::READ_MASK); return check_destroy (); @@ -813,7 +817,7 @@ int Sender::open (void *) if (ACE_Reactor::instance()->register_handler (this,flg_mask_) == -1) return -1; - + ACE_Deadlock_Free_TP_Reactor::instance()->add_annotation(this, (rand()%9) + 1); if (this->initiate_write () == -1) return -1; @@ -1187,6 +1191,8 @@ int run_main (int argc, ACE_TCHAR *argv[]) { // ACE_START_TEST (ACE_TEXT ("DA_Reactor_Test")); + //seed random number generator + srand((unsigned int)time((time_t *)NULL)); #if defined(ACE_HAS_THREADS) if (::parse_args (argc, argv) == -1) return -1; |