2 #ifndef BIG_ONEWAYS_SESSION_H
3 #define BIG_ONEWAYS_SESSION_H
5 #include /**/ "ace/pre.h"
8 #include "Session_Task.h"
10 #if defined(ACE_HAS_THREADS)
11 # include "ace/Barrier.h"
13 # include "ace/Null_Barrier.h"
14 #endif /* ACE_HAS_THREADS */
16 /// Implement the Test::Session interface
18 : public virtual POA_Test::Session
22 Session (Test::Session_Control_ptr control
,
23 CORBA::ULong payload_size
,
24 CORBA::ULong thread_count
,
25 CORBA::ULong message_count
,
26 CORBA::ULong peer_count
);
29 virtual ~Session (void);
31 /// Run one of the experiment threads
34 // = The skeleton methods
35 virtual void start (const Test::Session_List
&other_sessions
);
37 virtual void ping (void);
39 virtual void receive_payload (const Test::Payload
&the_payload
);
41 virtual void destroy (void);
44 /// Helper function used to report any problems and destroy local
46 void terminate (CORBA::Boolean success
);
48 /// Return 1 if all the work in this session has been completed
49 int more_work (void) const;
51 /// Make sure that all threads have connections avaiable to the
53 void validate_connections (void);
56 /// Synchronize the internal state
57 TAO_SYNCH_MUTEX mutex_
;
59 /// Keep a reference to the Session_Control, this is used to report
60 /// when the test finishes.
61 Test::Session_Control_var control_
;
63 /// Keep track of wether the test is running.
66 /// The other session objects participating in the test
67 Test::Session_List other_sessions_
;
69 /// Size of each message
70 CORBA::ULong payload_size_
;
73 CORBA::ULong thread_count_
;
75 /// Number of messages to send
76 CORBA::ULong message_count_
;
78 /// The number of threads currently running, when this reaches 0 the
79 /// session destroys itself.
80 CORBA::ULong active_thread_count_
;
82 /// Number of messages expected
83 CORBA::ULong expected_messages_
;
85 /// Helper class to run svc() in a separate thread
88 /// Barrier to start all threads simultaneously
89 #if defined(ACE_HAS_THREADS)
90 typedef ACE_Thread_Barrier Barrier
;
92 typedef ACE_Null_Barrier Barrier
;
93 #endif /* ACE_HAS_THREADS */
97 #include /**/ "ace/post.h"
99 #endif /* BIG_ONEWAYS_SESSION_H */