3 //=============================================================================
5 * @file Message_Queue_Test_Ex.h
7 * Define class needed for generating templates. IBM C++ requires this
8 * to be in its own file for auto template instantiation.
10 * @author Michael Vitlo <mvitalo@sprynet.com>
11 * @author Irfan Pyarali <irfan@cs.wustl.edu>
12 * @author David L. Levine <levine@cs.wustl.edu>
13 * @author Guy Peleg <guy.peleg@amdocs.com>
15 //=============================================================================
17 #ifndef ACE_TESTS_MESSAGE_QUEUE_TEST_EX_H
18 #define ACE_TESTS_MESSAGE_QUEUE_TEST_EX_H
20 #include "ace/OS_NS_string.h"
22 // User-defined class used for queue data.
26 User_Class (const char inputMsg
[])
30 ACE_NEW (this->message_
, char[ACE_OS::strlen (inputMsg
) + 1]);
31 ACE_OS::strcpy (this->message_
, inputMsg
);
34 ~User_Class (void) { delete [] this->message_
; }
36 const char *message (void) const
38 return this->message_
;
41 // This is for checking the ACE_Message_Queue_Ex_N
42 User_Class
*next () const
47 void next (User_Class
*uc
)
57 // The main tests for the ACE_Message_Queue_Ex_N
58 struct Receive_Messages
;
63 int single_thread_performance_test (void);
65 #if defined (ACE_HAS_THREADS)
66 int performance_test (void);
68 /// Sender runs with an autonomous thread
69 static ACE_THR_FUNC_RETURN
sender (void *);
71 /// Receiver runs with an autonomous thread
72 static ACE_THR_FUNC_RETURN
receiver (void *);
74 /// Multi threaded tests use this queue
75 ACE_Message_Queue_Ex_N
<User_Class
, ACE_MT_SYNCH
> mt_queue_
;
76 #endif /* ACE_HAS_THREADS */
78 /// Single threaded tests use this queue
79 ACE_Message_Queue_Ex_N
<User_Class
, ACE_NULL_SYNCH
> st_queue_
;
83 int test_enqueue_head (void);
84 int test_enqueue_tail (void);
87 #endif /* ACE_TESTS_MESSAGE_QUEUE_TEST_EX_H */