diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 2000-02-22 03:27:25 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 2000-02-22 03:27:25 +0000 |
commit | 78948a4e07507155988f1281b09ece795529e2c2 (patch) | |
tree | e5c628bac923b1953b0c616e5041522accc7a023 | |
parent | 7eee15d716b08f5bb587258f0059610ab93ce9a0 (diff) | |
download | ATCD-78948a4e07507155988f1281b09ece795529e2c2.tar.gz |
ChangeLogTag:Mon Feb 21 20:40:37 2000 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu>
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-02a | 13 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 13 | ||||
-rw-r--r-- | ace/MEM_Acceptor.h | 27 | ||||
-rw-r--r-- | ace/MEM_Connector.h | 16 | ||||
-rw-r--r-- | ace/MEM_IO.h | 16 | ||||
-rw-r--r-- | ace/MEM_SAP.h | 18 | ||||
-rw-r--r-- | ace/MEM_Stream.h | 4 | ||||
-rw-r--r-- | ace/Message_Block.cpp | 40 | ||||
-rw-r--r-- | ace/Message_Block.h | 38 | ||||
-rw-r--r-- | ace/Message_Block.i | 22 | ||||
-rw-r--r-- | tests/Dynamic_Priority_Test.cpp | 97 |
12 files changed, 218 insertions, 99 deletions
diff --git a/ChangeLog b/ChangeLog index fbdaf6ee06d..2db50fb9526 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Mon Feb 21 20:40:37 2000 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> + + * ace/MEM_*: Minor modifications to formatting here. + + * tests/Dynamic_Priority_Test.cpp: Only run this test if + ACE_HAS_TIMED_MESSAGE_BLOCKS is enabled. + + * ace/Message_Block: By default, the deadline_time_ and execution_time_ + data members are now omitted and their accessor/mutator + operations rendered "no-op"s unless ACE_HAS_TIMED_MESSAGE_BLOCKS + is enabled. This is necessary to avoid an unnecessary 16 bytes + per-Message_Block. Thanks to Irfan for pointing this out. + Mon Feb 21 17:22:33 2000 Ossama Othman <ossama@uci.edu> * configure.in (ACE_LACKS_SETREUID): diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index fbdaf6ee06d..2db50fb9526 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,3 +1,16 @@ +Mon Feb 21 20:40:37 2000 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> + + * ace/MEM_*: Minor modifications to formatting here. + + * tests/Dynamic_Priority_Test.cpp: Only run this test if + ACE_HAS_TIMED_MESSAGE_BLOCKS is enabled. + + * ace/Message_Block: By default, the deadline_time_ and execution_time_ + data members are now omitted and their accessor/mutator + operations rendered "no-op"s unless ACE_HAS_TIMED_MESSAGE_BLOCKS + is enabled. This is necessary to avoid an unnecessary 16 bytes + per-Message_Block. Thanks to Irfan for pointing this out. + Mon Feb 21 17:22:33 2000 Ossama Othman <ossama@uci.edu> * configure.in (ACE_LACKS_SETREUID): diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index fbdaf6ee06d..2db50fb9526 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,16 @@ +Mon Feb 21 20:40:37 2000 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> + + * ace/MEM_*: Minor modifications to formatting here. + + * tests/Dynamic_Priority_Test.cpp: Only run this test if + ACE_HAS_TIMED_MESSAGE_BLOCKS is enabled. + + * ace/Message_Block: By default, the deadline_time_ and execution_time_ + data members are now omitted and their accessor/mutator + operations rendered "no-op"s unless ACE_HAS_TIMED_MESSAGE_BLOCKS + is enabled. This is necessary to avoid an unnecessary 16 bytes + per-Message_Block. Thanks to Irfan for pointing this out. + Mon Feb 21 17:22:33 2000 Ossama Othman <ossama@uci.edu> * configure.in (ACE_LACKS_SETREUID): diff --git a/ace/MEM_Acceptor.h b/ace/MEM_Acceptor.h index 3cd0bc28578..e24e2fc5bd3 100644 --- a/ace/MEM_Acceptor.h +++ b/ace/MEM_Acceptor.h @@ -10,7 +10,7 @@ // MEM_Aceeptor.h // // = AUTHOR -// Nanbor Wang +// Nanbor Wang <nanbor@cs.wustl.edu> // // ============================================================================ @@ -33,14 +33,17 @@ class ACE_Export ACE_MEM_Acceptor : public ACE_SOCK_Acceptor { // = TITLE // Defines the format and interface for the acceptor side of the - // local mmap stream. I should probably designed the class - // to prevent user passing a non-localhost endpoint as the acceptor - // listen point because it doesn't make any sense at all to make - // the listening endpoint visible (or connectable) anywhere outside - // of this machine. However, I decided to leave the type of endpoint - // as <ACE_Addr> so we can later changed to use UNIX sockets with - // mmap stream if so desired. (Currently, using UNIX socket with - // this class will not work.) + // local mmap stream. + // + // = DESCRIPTION + // This class should be modified to prevent user passing a + // non-localhost endpoint as the acceptor listen point because + // it doesn't make any sense at all to make the listening + // endpoint visible (or connectable) anywhere outside of this + // machine. However, the type of endpoint is left as <ACE_Addr> + // so we can later changed to use UNIX sockets with mmap stream + // if so desired. (Currently, using UNIX socket with this class + // will not work.) public: // = Initialization methods. ACE_MEM_Acceptor (void); @@ -85,8 +88,8 @@ public: // ${(TMP|TEMP)}//ACE_MEM_Acceptor_(port-number)_(&stream), // otherwise, it is <mmap_prefix_>_(port-number)_(&stream), // <mmap_prefix_> should include _absolute_ path so the connector - // within the same host can located the mmap file. - // Example: /tmp/mmapfile + // within the same host can located the mmap file. Example: + // /tmp/mmapfile. int get_local_addr (ACE_MEM_Addr &) const; // Return the local endpoint address in the referenced <ACE_Addr>. @@ -137,8 +140,10 @@ protected: private: ASYS_TCHAR *mmap_prefix_; + // @@ Nanbor, can you please add a comment here? ACE_MEM_SAP::MALLOC_OPTIONS malloc_options_; + // @@ Nanbor, can you please add a comment here? }; #if !defined (ACE_LACKS_INLINE_FUNCTIONS) diff --git a/ace/MEM_Connector.h b/ace/MEM_Connector.h index 4879708efb4..27d6b4b3877 100644 --- a/ace/MEM_Connector.h +++ b/ace/MEM_Connector.h @@ -10,7 +10,7 @@ // MEM_Connector.h // // = AUTHOR -// Nanbor Wang +// Nanbor Wang <nanbor@cs.wustl.edu> // // ============================================================================ @@ -54,9 +54,9 @@ public: // this is the amount of time to wait before timing out. If the // time expires before the connection is made <errno == ETIME>. The // <local_sap> is the value of local address to bind to. If it's - // the default value of <0> then the user is letting - // the OS do the binding. If <reuse_addr> == 1 then the - // <local_addr> is reused, even if it hasn't been cleanedup yet. + // the default value of <0> then the user is letting the OS do the + // binding. If <reuse_addr> == 1 then the <local_addr> is reused, + // even if it hasn't been cleanedup yet. int connect (ACE_MEM_Stream &new_stream, const ACE_INET_Addr &remote_sap, @@ -76,9 +76,9 @@ public: // this is the amount of time to wait before timing out. If the // time expires before the connection is made <errno == ETIME>. The // <local_sap> is the value of local address to bind to. If it's - // the default value of <0> then the user is letting - // the OS do the binding. If <reuse_addr> == 1 then the - // <local_addr> is reused, even if it hasn't been cleanedup yet. + // the default value of <0> then the user is letting the OS do the + // binding. If <reuse_addr> == 1 then the <local_addr> is reused, + // even if it hasn't been cleanedup yet. ACE_MEM_SAP::MALLOC_OPTIONS &malloc_options (void); // Accessor to underlying malloc options. @@ -95,8 +95,10 @@ public: private: ACE_MEM_Addr address_; + // @@ Nanbor, can you please add a comment here? ACE_MEM_SAP::MALLOC_OPTIONS malloc_options_; + // @@ Nanbor, can you please add a comment here? }; #if !defined (ACE_LACKS_INLINE_FUNCTIONS) diff --git a/ace/MEM_IO.h b/ace/MEM_IO.h index 71d4e39f71a..6901b11cdcd 100644 --- a/ace/MEM_IO.h +++ b/ace/MEM_IO.h @@ -10,7 +10,7 @@ // MEM_IO.h // // = AUTHOR -// Nanbor Wang +// Nanbor Wang <nanbor@cs.wustl.edu> // // ============================================================================ @@ -29,11 +29,11 @@ class ACE_Export ACE_MEM_IO : public ACE_SOCK, public ACE_MEM_SAP { // = TITLE - // Defines the methods for the ACE shared memeory wrapper I/O routines - // (e.g., send/recv). + // Defines the methods for the ACE shared memeory wrapper I/O + // routines (e.g., send/recv). public: // = Initialization and termination methods. - ACE_MEM_IO (); + ACE_MEM_IO (void); // Constructor. ~ACE_MEM_IO (void); @@ -60,7 +60,7 @@ public: // Recv an <n> byte buffer from the shm_malloc_ thru connected socket. ssize_t fetch_recv_buf (int flags, const ACE_Time_Value *timeout = 0); - // @@ Please fill in here. + // @@ Nanbor, please fill in here. ssize_t send (const void *buf, size_t n, @@ -121,14 +121,14 @@ private: // Internal pointer for support recv/send. ssize_t buf_size_; - // total buffer size. + // Total buffer size. ssize_t cur_offset_; - // current read pointer location. + // Current read pointer location. }; #if !defined (ACE_LACKS_INLINE_FUNCTIONS) #include "ace/MEM_IO.i" -#endif +#endif /* ACE_LACKS_INLINE_FUNCTIONS */ #endif /* ACE_SOCK_IO_H */ diff --git a/ace/MEM_SAP.h b/ace/MEM_SAP.h index 68afe1e3940..85b493013a6 100644 --- a/ace/MEM_SAP.h +++ b/ace/MEM_SAP.h @@ -10,7 +10,7 @@ // MEM_SAP.h // // = AUTHOR -// Nanbor Wang +// Nanbor Wang <nanbor@cs.wustl.edu> // // ============================================================================ @@ -42,7 +42,7 @@ public: ~ACE_MEM_SAP (void); // Destructor. - void * acquire_buffer (const ssize_t size); + void *acquire_buffer (const ssize_t size); // request a buffer of size <size>. Return 0 if the <shm_malloc_> is // not initialized. @@ -72,18 +72,18 @@ public: // Declare the dynamic allocation hooks. protected: - // = Class initializing methods to create/connect to a shared memory pool. int create_shm_malloc (LPCTSTR name, MALLOC_OPTIONS *options = 0); - // Create a new shm_malloc object. Return 0 if succeed and -1 otherwise. - // This method should only be called from an acceptor class that wants to - // create a new memory pool for inter process communication. + // Create a new shm_malloc object. Return 0 if succeed and -1 + // otherwise. This method should only be called from an acceptor + // class that wants to create a new memory pool for inter process + // communication. int close_shm_malloc (const int remove = 0); - // Close down the share memory pool. If <remove> != 0, then the mmap file - // will also get removed. + // Close down the share memory pool. If <remove> != 0, then the + // mmap file will also get removed. MALLOC_TYPE *shm_malloc_; // Data exchange channel. @@ -94,6 +94,6 @@ protected: #if !defined (ACE_LACKS_INLINE_FUNCTIONS) #include "ace/MEM_SAP.i" -#endif +#endif /* ACE_LACKS_INLINE_FUNCTIONS */ #endif /* ACE_SOCK_IO_H */ diff --git a/ace/MEM_Stream.h b/ace/MEM_Stream.h index f31b6cbec2c..6639a254874 100644 --- a/ace/MEM_Stream.h +++ b/ace/MEM_Stream.h @@ -10,7 +10,7 @@ // MEM_Stream.h // // = AUTHOR -// Nanbor Wang +// Nanbor Wang <nanbor@cs.wustl.edu> // // ============================================================================ @@ -121,6 +121,6 @@ public: #if !defined (ACE_LACKS_INLINE_FUNCTIONS) #include "ace/MEM_Stream.i" -#endif +#endif /* ACE_LACKS_INLINE_FUNCTIONS */ #endif /* ACE_MEM_STREAM_H */ diff --git a/ace/Message_Block.cpp b/ace/Message_Block.cpp index ff5e761ef86..a0dc2d5cca3 100644 --- a/ace/Message_Block.cpp +++ b/ace/Message_Block.cpp @@ -378,8 +378,8 @@ ACE_Message_Block::ACE_Message_Block (size_t size, ACE_Allocator *allocator_strategy, ACE_Lock *locking_strategy, u_long priority, - const ACE_Time_Value & execution_time, - const ACE_Time_Value & deadline_time, + const ACE_Time_Value &execution_time, + const ACE_Time_Value &deadline_time, ACE_Allocator *data_block_allocator, ACE_Allocator *message_block_allocator) : data_block_ (0) @@ -411,8 +411,8 @@ ACE_Message_Block::init (size_t size, ACE_Allocator *allocator_strategy, ACE_Lock *locking_strategy, u_long priority, - const ACE_Time_Value & execution_time, - const ACE_Time_Value & deadline_time, + const ACE_Time_Value &execution_time, + const ACE_Time_Value &deadline_time, ACE_Allocator *data_block_allocator, ACE_Allocator *message_block_allocator) { @@ -463,8 +463,8 @@ ACE_Message_Block::ACE_Message_Block (size_t size, ACE_Lock *locking_strategy, Message_Flags flags, u_long priority, - const ACE_Time_Value & execution_time, - const ACE_Time_Value & deadline_time, + const ACE_Time_Value &execution_time, + const ACE_Time_Value &deadline_time, ACE_Data_Block *db, ACE_Allocator *data_block_allocator, ACE_Allocator *message_block_allocator) @@ -521,8 +521,8 @@ ACE_Message_Block::init_i (size_t size, ACE_Lock *locking_strategy, Message_Flags flags, u_long priority, - const ACE_Time_Value & execution_time, - const ACE_Time_Value & deadline_time, + const ACE_Time_Value &execution_time, + const ACE_Time_Value &deadline_time, ACE_Data_Block *db, ACE_Allocator *data_block_allocator, ACE_Allocator *message_block_allocator) @@ -533,8 +533,10 @@ ACE_Message_Block::init_i (size_t size, this->rd_ptr_ = 0; this->wr_ptr_ = 0; this->priority_ = priority; +#if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS) this->execution_time_ = execution_time; this->deadline_time_ = deadline_time; +#endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */ this->cont_ = msg_cont; this->next_ = 0; this->prev_ = 0; @@ -831,8 +833,13 @@ ACE_Message_Block::duplicate (void) const 0, // locking strategy 0, // flags this->priority_, // priority +#if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS) this->execution_time_, // execution time this->deadline_time_, // absolute time to deadline +#else + ACE_Time_Value::zero, // execution time + ACE_Time_Value::max_time, // absolute time of deadline +#endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */ // Get a pointer to a // "duplicated" <ACE_Data_Block> // (will simply increment the @@ -853,8 +860,13 @@ ACE_Message_Block::duplicate (void) const 0, // locking strategy 0, // flags this->priority_, // priority +#if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS) this->execution_time_, // execution time this->deadline_time_, // absolute time to deadline +#else + ACE_Time_Value::zero, // execution time + ACE_Time_Value::max_time, // absolute time of deadline +#endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */ // Get a pointer to a // "duplicated" <ACE_Data_Block> // (will simply increment the @@ -969,8 +981,13 @@ ACE_Message_Block::clone (Message_Flags mask) const 0, // locking strategy 0, // flags this->priority_, // priority +#if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS) this->execution_time_, // execution time this->deadline_time_, // absolute time to deadline +#else + ACE_Time_Value::zero, // execution time + ACE_Time_Value::max_time, // absolute time of deadline +#endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */ // Get a pointer to a // "duplicated" <ACE_Data_Block> // (will simply increment the @@ -996,10 +1013,15 @@ ACE_Message_Block::clone (Message_Flags mask) const 0, // locking strategy 0, // flags this->priority_, // priority +#if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS) this->execution_time_, // execution time this->deadline_time_, // absolute time to deadline +#else + ACE_Time_Value::zero, // execution time + ACE_Time_Value::max_time, // absolute time of deadline +#endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */ db, - db->data_block_allocator(), + db->data_block_allocator (), this->message_block_allocator_); } diff --git a/ace/Message_Block.h b/ace/Message_Block.h index 901cfb05f9f..ab43c9b8570 100644 --- a/ace/Message_Block.h +++ b/ace/Message_Block.h @@ -122,8 +122,8 @@ public: ACE_Allocator *allocator_strategy = 0, ACE_Lock *locking_strategy = 0, u_long priority = ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY, - const ACE_Time_Value & execution_time = ACE_Time_Value::zero, - const ACE_Time_Value & deadline_time = ACE_Time_Value::max_time, + const ACE_Time_Value &execution_time = ACE_Time_Value::zero, + const ACE_Time_Value &deadline_time = ACE_Time_Value::max_time, ACE_Allocator *data_block_allocator = 0, ACE_Allocator *message_block_allocator = 0); // Create an initialized message of type <type> containing <size> @@ -161,8 +161,8 @@ public: ACE_Allocator *allocator_strategy = 0, ACE_Lock *locking_strategy = 0, u_long priority = ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY, - const ACE_Time_Value & execution_time = ACE_Time_Value::zero, - const ACE_Time_Value & deadline_time = ACE_Time_Value::max_time, + const ACE_Time_Value &execution_time = ACE_Time_Value::zero, + const ACE_Time_Value &deadline_time = ACE_Time_Value::max_time, ACE_Allocator *data_block_allocator = 0, ACE_Allocator *message_block_allocator = 0); // Create an initialized message of type <type> containing <size> @@ -218,16 +218,16 @@ public: void msg_priority (u_long priority); // Set priority of the message. - const ACE_Time_Value & msg_execution_time (void) const; + const ACE_Time_Value &msg_execution_time (void) const; // Get execution time associated with the message. - void msg_execution_time (const ACE_Time_Value & et); + void msg_execution_time (const ACE_Time_Value &et); // Set execution time associated with the message. - const ACE_Time_Value & msg_deadline_time (void) const; + const ACE_Time_Value &msg_deadline_time (void) const; // Get absolute time of deadline associated with the message. - void msg_deadline_time (const ACE_Time_Value & dt); + void msg_deadline_time (const ACE_Time_Value &dt); // Set absolute time of deadline associated with the message. // = Deep copy and shallow copy methods. @@ -425,8 +425,8 @@ protected: ACE_Lock *locking_strategy, Message_Flags flags, u_long priority, - const ACE_Time_Value & execution_time, - const ACE_Time_Value & deadline_time, + const ACE_Time_Value &execution_time, + const ACE_Time_Value &deadline_time, ACE_Data_Block *db, ACE_Allocator *data_block_allocator, ACE_Allocator *message_block_allocator); @@ -444,8 +444,8 @@ protected: ACE_Lock *locking_strategy, Message_Flags flags, u_long priority, - const ACE_Time_Value & execution_time, - const ACE_Time_Value & deadline_time, + const ACE_Time_Value &execution_time, + const ACE_Time_Value &deadline_time, ACE_Data_Block *db, ACE_Allocator *data_block_allocator, ACE_Allocator *message_block_allocator); @@ -460,11 +460,13 @@ protected: u_long priority_; // Priority of message. +#if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS) ACE_Time_Value execution_time_; // execution time associated with the message ACE_Time_Value deadline_time_; // absolute deadline time for message +#endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */ // = Links to other ACE_Message_Block *s. ACE_Message_Block *cont_; @@ -736,8 +738,8 @@ public: // Dump the state of the strategy. protected: - virtual void convert_priority (ACE_Time_Value & priority, - const ACE_Message_Block & mb) = 0; + virtual void convert_priority (ACE_Time_Value &priority, + const ACE_Message_Block &mb) = 0; // Hook method for dynamic priority conversion. u_long static_bit_field_mask_; @@ -789,8 +791,8 @@ public: virtual ~ACE_Deadline_Message_Strategy (void); // Virtual dtor. - virtual void convert_priority (ACE_Time_Value & priority, - const ACE_Message_Block & mb); + virtual void convert_priority (ACE_Time_Value &priority, + const ACE_Message_Block &mb); // Dynamic priority conversion function based on time to deadline. virtual void dump (void) const; @@ -823,8 +825,8 @@ public: virtual ~ACE_Laxity_Message_Strategy (void); // virtual dtor. - virtual void convert_priority (ACE_Time_Value & priority, - const ACE_Message_Block & mb); + virtual void convert_priority (ACE_Time_Value &priority, + const ACE_Message_Block &mb); // Dynamic priority conversion function based on laxity. virtual void dump (void) const; diff --git a/ace/Message_Block.i b/ace/Message_Block.i index 99b36a8a8d4..b034f7e9ea6 100644 --- a/ace/Message_Block.i +++ b/ace/Message_Block.i @@ -203,29 +203,45 @@ ACE_INLINE const ACE_Time_Value & ACE_Message_Block::msg_execution_time (void) const { ACE_TRACE ("ACE_Message_Block::msg_execution_time (void)"); +#if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS) return this->execution_time_; +#else + return ACE_Time_Value::zero; +#endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */ } - ACE_INLINE void -ACE_Message_Block::msg_execution_time (const ACE_Time_Value & et) +ACE_Message_Block::msg_execution_time (const ACE_Time_Value &et) { ACE_TRACE ("ACE_Message_Block::msg_execution_time (const ACE_Time_Value & et)"); +#if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS) this->execution_time_ = et; +#else + ACE_UNUSED_ARG (et); +#endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */ } ACE_INLINE const ACE_Time_Value & ACE_Message_Block::msg_deadline_time (void) const { ACE_TRACE ("ACE_Message_Block::msg_deadline_time (void)"); + +#if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS) return this->deadline_time_; +#else + return ACE_Time_Value::max_time; // absolute time of deadline +#endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */ } ACE_INLINE void -ACE_Message_Block::msg_deadline_time (const ACE_Time_Value & dt) +ACE_Message_Block::msg_deadline_time (const ACE_Time_Value &dt) { ACE_TRACE ("ACE_Message_Block::msg_deadline_time (const ACE_Time_Value & et)"); +#if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS) this->deadline_time_ = dt; +#else + ACE_UNUSED_ARG (dt); +#endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */ } ACE_INLINE char * diff --git a/tests/Dynamic_Priority_Test.cpp b/tests/Dynamic_Priority_Test.cpp index d1b46b7ef87..1e9aca52354 100644 --- a/tests/Dynamic_Priority_Test.cpp +++ b/tests/Dynamic_Priority_Test.cpp @@ -10,10 +10,11 @@ // // = DESCRIPTION // This is a test to verify and illustrate the static and dynamic -// priority mechanisms of the ACE_Message_Queue class and the -// ACE_Dynamic_Message_Queue class. As in the Priority_Buffer_Test, -// a producer generates messages and enqueues them, and a consumer -// dequeues them and checks their ordering. +// priority mechanisms of the <ACE_Message_Queue> class and the +// <ACE_Dynamic_Message_Queue> class. As in the +// <Priority_Buffer_Test>, a producer generates messages and +// enqueues them, and a consumer dequeues them and checks their +// ordering. // // In these tests, every effort is made to ensure that there is // plenty of time for the messages to be enqueued and dequeued, @@ -133,9 +134,12 @@ order_consumer (void *args) { ACE_ASSERT (args != 0); - ACE_Message_Queue<ACE_SYNCH> *msg_queue = ACE_static_cast (ArgStruct *, args)->queue_; - const char *receipt_order = ACE_static_cast (ArgStruct *, args)->order_string_; - u_int expected_count = ACE_static_cast (ArgStruct *, args)->expected_count_; + ACE_Message_Queue<ACE_SYNCH> *msg_queue = + ACE_static_cast (ArgStruct *, args)->queue_; + const char *receipt_order = + ACE_static_cast (ArgStruct *, args)->order_string_; + u_int expected_count = + ACE_static_cast (ArgStruct *, args)->expected_count_; ACE_ASSERT (receipt_order != 0); ACE_ASSERT (msg_queue != 0); @@ -176,10 +180,14 @@ order_producer (void *args) { ACE_ASSERT (args != 0); - ACE_Message_Queue<ACE_SYNCH> *msg_queue = ACE_static_cast (ArgStruct *, args)->queue_; - const char *send_order = ACE_static_cast (ArgStruct *, args)->order_string_; - ACE_Message_Block **block_array = ACE_static_cast (ArgStruct *, args)->array_; - int expected_count = ACE_static_cast (ArgStruct *, args)->expected_count_; + ACE_Message_Queue<ACE_SYNCH> *msg_queue = + ACE_static_cast (ArgStruct *, args)->queue_; + const char *send_order = + ACE_static_cast (ArgStruct *, args)->order_string_; + ACE_Message_Block **block_array = + ACE_static_cast (ArgStruct *, args)->array_; + int expected_count = + ACE_static_cast (ArgStruct *, args)->expected_count_; ACE_ASSERT (send_order != 0); ACE_ASSERT (block_array != 0); @@ -249,7 +257,9 @@ run_order_test (ACE_Message_Queue<ACE_SYNCH>* msg_queue, supplier_args.array_[i]->msg_priority (i); // Assign every other message short or long execution time. - supplier_args.array_[i]->msg_execution_time (((i % 2) ? slow_execution : fast_execution)); + supplier_args.array_[i]->msg_execution_time (((i % 2) + ? slow_execution + : fast_execution)); } consumer_args.queue_ = msg_queue; @@ -276,7 +286,7 @@ run_order_test (ACE_Message_Queue<ACE_SYNCH>* msg_queue, for (i = 0; i < array_size; ++i) { - switch ((4*i)/array_size) + switch ((4 * i) / array_size) { case 0: supplier_args.array_[i]->msg_deadline_time (future_deadline); @@ -292,7 +302,7 @@ run_order_test (ACE_Message_Queue<ACE_SYNCH>* msg_queue, break; // should never reach here, but its better to make sure default: - ACE_ASSERT ((4*i)/array_size < 4); + ACE_ASSERT ((4 * i) / array_size < 4); break; } } @@ -327,8 +337,10 @@ performance_consumer (void * args) ACE_ASSERT (args != 0); - ACE_Message_Queue<ACE_SYNCH> *msg_queue = ACE_static_cast (ArgStruct *, args)->queue_; - u_int expected_count = ACE_static_cast (ArgStruct *, args)->expected_count_; + ACE_Message_Queue<ACE_SYNCH> *msg_queue = + ACE_static_cast (ArgStruct *, args)->queue_; + u_int expected_count = + ACE_static_cast (ArgStruct *, args)->expected_count_; ACE_ASSERT (msg_queue != 0); @@ -342,10 +354,8 @@ performance_consumer (void * args) // Keep looping, reading a message out of the queue, until the // expected number of messages have been dequeued. for (local_count = 0; local_count < expected_count; ++local_count) - { - if (msg_queue->dequeue_head (mb) == -1) - break; - } + if (msg_queue->dequeue_head (mb) == -1) + break; // Stop timer, obtain and report its elapsed time.x timer.stop (); @@ -373,9 +383,12 @@ performance_producer (void *args) ACE_ASSERT (args != 0); - ACE_Message_Queue<ACE_SYNCH> *msg_queue = ACE_static_cast (ArgStruct *, args)->queue_; - ACE_Message_Block **block_array = ACE_static_cast (ArgStruct *, args)->array_; - int expected_count = ACE_static_cast (ArgStruct *, args)->expected_count_; + ACE_Message_Queue<ACE_SYNCH> *msg_queue = + ACE_static_cast (ArgStruct *, args)->queue_; + ACE_Message_Block **block_array = + ACE_static_cast (ArgStruct *, args)->array_; + int expected_count = + ACE_static_cast (ArgStruct *, args)->expected_count_; ACE_ASSERT (send_order != 0); ACE_ASSERT (block_array != 0); @@ -515,13 +528,16 @@ run_performance_test (u_int min_load, // Fill in information for all types of tests. for (i = 0; i < load; ++i) { - // construct a message new block off the heap, to hold a single character + // Construct a message new block off the heap, to hold a + // single character. ACE_NEW_RETURN (supplier_args.array_[i], ACE_Message_Block (1), -1); // Assign every other message short or long execution time. - supplier_args.array_[i]->msg_execution_time (((i % 2) ? slow_execution : fast_execution)); + supplier_args.array_[i]->msg_execution_time (((i % 2) + ? slow_execution + : fast_execution)); } // Fill in information for the specific type of test. @@ -541,6 +557,7 @@ run_performance_test (u_int min_load, // Assign time to deadline in descending order. time_offsets [i] = time_offsets [i - 1] + offset_step; } + break; case WORST: // Fill in worst case information. @@ -678,6 +695,7 @@ main (int, ASYS_TCHAR *[]) { ACE_START_TEST (ASYS_TEXT ("Dynamic_Priority_Test")); +#if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS) // Enable FIFO scheduling, e.g., RT scheduling class on Solaris. if (ACE_OS::sched_params ( ACE_Sched_Params ( @@ -703,23 +721,31 @@ main (int, ASYS_TCHAR *[]) ACE_Message_Queue<ACE_SYNCH> *test_queue = ACE_Message_Queue_Factory<ACE_SYNCH>::create_static_message_queue (max_queue); ACE_ASSERT (test_queue != 0); - run_order_test (test_queue, send_order, static_receipt_order); + run_order_test (test_queue, + send_order, + static_receipt_order); delete test_queue; // Test factory, dynamic message queue (deadline strategy). - test_queue = ACE_Message_Queue_Factory<ACE_SYNCH>::create_deadline_message_queue (max_queue); + test_queue = + ACE_Message_Queue_Factory<ACE_SYNCH>::create_deadline_message_queue (max_queue); ACE_ASSERT (test_queue != 0); - run_order_test (test_queue, send_order, deadline_receipt_order); + run_order_test (test_queue, + send_order, + deadline_receipt_order); delete test_queue; // Test factory, dynamic message queue (laxity strategy). - test_queue = ACE_Message_Queue_Factory<ACE_SYNCH>::create_laxity_message_queue (max_queue); + test_queue = + ACE_Message_Queue_Factory<ACE_SYNCH>::create_laxity_message_queue (max_queue); ACE_ASSERT (test_queue != 0); - run_order_test (test_queue, send_order, laxity_receipt_order); + run_order_test (test_queue, + send_order, + laxity_receipt_order); delete test_queue; #if defined (VXWORKS) - // test factory for VxWorks message queue + // test factory for VxWorks message queue. ACE_Message_Queue_Vx *test_queue_vx = ACE_Message_Queue_Factory<ACE_NULL_SYNCH>::create_Vx_message_queue (vx_max_queue, vx_msg_size); @@ -738,19 +764,26 @@ main (int, ASYS_TCHAR *[]) // For each of an increasing number of message loads, run the same // performance test (best case, worst case, and randomized, over - // each kind of queue + // each kind of queue). run_performance_test (MIN_LOAD, MAX_LOAD, LOAD_STEP, BEST); + run_performance_test (MIN_LOAD, MAX_LOAD, LOAD_STEP, WORST); + run_performance_test (MIN_LOAD, MAX_LOAD, LOAD_STEP, RANDOM); +#else + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("ACE is not compiled with ACE_HAS_TIMED_MESSAGE_BLOCKS enabled\n"))); +#endif /* ACE_HAS_TIMED_MESSAGE_BLOCKS */ + ACE_END_TEST; return 0; } |