MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / svc

Method svc

dds/DCPS/ReactorTask.cpp:178–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178int ReactorTask::svc()
179{
180 // Every activated ACE task thread ends with close(), which drops a
181 // self-reference. Take that reference here for both single-threaded and
182 // multi-threaded reactor execution.
183 _add_ref();
184
185 if (n_threads_ > 1) {
186 return run_reactor_i();
187 }
188
189 ThreadStatusManager::Start s(*thread_status_manager_, name_);
190
191 {
192 GuardType guard(lock_);
193
194 // Ignore all signals to avoid
195 // ERROR: <something descriptive> Interrupted system call
196 // The main thread will handle signals.
197 sigset_t set;
198 ACE_OS::sigfillset(&set);
199 ACE_OS::thr_sigsetmask(SIG_SETMASK, &set, NULL);
200
201 // Tell the reactor that this thread will be its owner
202 if (reactor_->owner(ACE_Thread_Manager::instance()->thr_self()) != 0) {
203 ACE_ERROR((LM_ERROR,
204 "(%P|%t) ERROR: Failed to change the reactor's owner().\n"));
205 }
206 reactor_owners_.bind(ACE_Thread_Manager::instance()->thr_self(), 1);
207
208 ACE_Event_Handler::reactor(reactor_);
209
210 // Advance the state.
211 state_ = STATE_RUNNING;
212 condition_.notify_all();
213 }
214
215 thread_status_period_ = thread_status_manager_->thread_status_interval();
216 if (thread_status_period_) {
217 tsm_updater_handler_ = make_rch<ThreadStatusManager::Updater>();
218 thread_status_timer_ = reactor_wrapper_.schedule(*tsm_updater_handler_, thread_status_manager_,
219 thread_status_period_, thread_status_period_);
220
221 if (thread_status_timer_ == ReactorWrapper::InvalidTimerId) {
222 if (log_level >= LogLevel::Notice) {
223 ACE_ERROR((LM_ERROR, "(%P|%t) NOTICE: ReactorTask::svc: failed to "
224 "schedule timer for ThreadStatusManager::Updater\n"));
225 }
226 }
227 }
228
229 ConfigReaderListener_rch this_rch(this, inc_count());
230 ConfigReader_rch config_reader = make_rch<ConfigReader>(TheServiceParticipant->config_store()->datareader_qos(), this_rch);
231 TheServiceParticipant->config_topic()->connect(config_reader);
232
233 ThreadStatusManager::Sleeper sleeper(thread_status_manager_);
234 reactor_->run_reactor_event_loop();
235

Callers

nothing calls this directly

Calls 13

_add_refFunction · 0.85
instanceFunction · 0.85
ownerMethod · 0.80
notify_allMethod · 0.80
datareader_qosMethod · 0.80
config_storeMethod · 0.80
inc_countClass · 0.70
bindMethod · 0.45
scheduleMethod · 0.45
connectMethod · 0.45
disconnectMethod · 0.45

Tested by

no test coverage detected