3 //=============================================================================
5 * @file Message_Queue_Test_Ex.h
7 * Define class needed for generating templates.
9 * @author Michael Vitlo <mvitalo@sprynet.com>
10 * @author Irfan Pyarali <irfan@cs.wustl.edu>
11 * @author David L. Levine <levine@cs.wustl.edu>
12 * @author Guy Peleg <guy.peleg@amdocs.com>
14 //=============================================================================
16 #ifndef ACE_TESTS_MESSAGE_QUEUE_TEST_EX_H
17 #define ACE_TESTS_MESSAGE_QUEUE_TEST_EX_H
19 #include "ace/OS_NS_string.h"
21 // User-defined class used for queue data.
25 User_Class (const char inputMsg
[])
27 ACE_NEW (this->message_
, char[ACE_OS::strlen (inputMsg
) + 1]);
28 ACE_OS::strcpy (this->message_
, inputMsg
);
31 ~User_Class () { delete [] this->message_
; }
33 const char *message () const
35 return this->message_
;
38 // This is for checking the ACE_Message_Queue_Ex_N
39 User_Class
*next () const
44 void next (User_Class
*uc
)
54 // The main tests for the ACE_Message_Queue_Ex_N
55 struct Receive_Messages
;
60 int single_thread_performance_test ();
62 #if defined (ACE_HAS_THREADS)
63 int performance_test ();
65 /// Sender runs with an autonomous thread
66 static ACE_THR_FUNC_RETURN
sender (void *);
68 /// Receiver runs with an autonomous thread
69 static ACE_THR_FUNC_RETURN
receiver (void *);
71 /// Multi threaded tests use this queue
72 ACE_Message_Queue_Ex_N
<User_Class
, ACE_MT_SYNCH
> mt_queue_
;
73 #endif /* ACE_HAS_THREADS */
75 /// Single threaded tests use this queue
76 ACE_Message_Queue_Ex_N
<User_Class
, ACE_NULL_SYNCH
> st_queue_
;
80 int test_enqueue_head ();
81 int test_enqueue_tail ();
84 #endif /* ACE_TESTS_MESSAGE_QUEUE_TEST_EX_H */