File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -187,11 +187,33 @@ int main(int argc, char *argv[]) {
187
187
return fn->second (argv[0 ], config::sunshine.cmd .argc , config::sunshine.cmd .argv );
188
188
}
189
189
190
+ task_pool.start (1 );
191
+
190
192
// Create signal handler after logging has been initialized
191
193
auto shutdown_event = mail::man->event <bool >(mail::shutdown);
192
194
on_signal (SIGINT, [shutdown_event]() {
193
195
BOOST_LOG (info) << " Interrupt handler called" sv;
194
196
197
+ task_pool.pushDelayed ([]() {
198
+ BOOST_LOG (fatal) << " 10 seconds passed, yet Sunshine's still running: Forcing shutdown" sv;
199
+ log_flush ();
200
+ std::abort ();
201
+ },
202
+ 10s);
203
+
204
+ shutdown_event->raise (true );
205
+ });
206
+
207
+ on_signal (SIGTERM, [shutdown_event]() {
208
+ BOOST_LOG (info) << " Terminate handler called" sv;
209
+
210
+ task_pool.pushDelayed ([]() {
211
+ BOOST_LOG (fatal) << " 10 seconds passed, yet Sunshine's still running: Forcing shutdown" sv;
212
+ log_flush ();
213
+ std::abort ();
214
+ },
215
+ 10s);
216
+
195
217
shutdown_event->raise (true );
196
218
});
197
219
@@ -226,8 +248,6 @@ int main(int argc, char *argv[]) {
226
248
return 0 ;
227
249
}
228
250
229
- task_pool.start (1 );
230
-
231
251
std::thread httpThread { nvhttp::start };
232
252
std::thread configThread { confighttp::start };
233
253
You can’t perform that action at this time.
0 commit comments