42 {
43 {
44
46 { "ApplicationMgr.JobOptionsType", "\"NONE\"" },
47 { "ApplicationMgr.EventLoop", "\"Gaudi::TestSuite::QueueingEventLoopMgr/QueueingEventLoopMgr\"" },
48 { "ApplicationMgr.OutputLevel", "3" },
49 { "ApplicationMgr.TopAlg", "['GaudiTesting::SleepyAlg/Alg1']" },
50 { "Alg1.SleepTime", "1" },
51 { "QueueingEventLoopMgr.OutputLevel", "2" },
52 { "QueueingEventLoopMgr.Capacity", "3" } };
53
55
57
58 const std::size_t n_of_batches = 2;
59 const std::size_t evts_in_batch = 5;
60
61
62 app->initialize().ignore();
63
64
66
67
70
71 app->start().ignore();
72
73
74 {
75
77
78
79
80 std::queue<EventContext> ready;
81
82 std::size_t evt_count = 0;
83
84
85 for ( std::size_t batch = 1; batch <= n_of_batches; ++batch ) {
86
88 if ( batch == 2 ) {
89 log <<
MSG::INFO <<
" (pretend we need time so that the processing thread drains the input queue)"
91 sleep_for( 4s );
92 log <<
MSG::INFO <<
" (all events in the queue should have been processed by now)" <<
endmsg;
93 }
94 for ( std::size_t i = 0; i < evts_in_batch; ++i ) {
95
96 auto ctx = qep->createEventContext();
97
98
99 ready.push( std::move( ctx ) );
100 }
101
102
104 while ( !ready.empty() ) {
105 ++evt_count;
106 log <<
MSG::INFO <<
"- pushing event " << evt_count <<
" (" << ready.front() <<
")..." <<
endmsg;
107 qep->push( std::move( ready.front() ) );
108 ready.pop();
110
111
113 if ( auto result = qep->pop() ) {
114
115 auto&& [sc,
ctx] = std::move( *result );
117 }
118 }
119 }
121 while ( !qep->empty() ) {
122 if ( auto result = qep->pop() ) {
123 auto&& [sc,
ctx] = std::move( *result );
125 } else {
126 sleep_for( 10ms );
127 }
128 }
129
130
132 }
133
134
135 app->stop().ignore();
136 app->finalize().ignore();
137
138
140 } );
141 }
142}
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Gaudi application entry point.
std::map< std::string, std::string > Options
The IMessage is the interface implemented by the message service.
The IProperty is the basic interface for all components which have properties that can be set or get.
Definition of the MsgStream class used to transmit messages.
Small smart pointer class with automatic reference counting for IInterface.
int getAppReturnCode(const SmartIF< IProperty > &appmgr)
Get the application (current) return code.