File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 32
32
#include < bitset>
33
33
#include < clocale>
34
34
#include < csignal>
35
+ #include < future>
35
36
#include < string>
36
37
#include < thread>
37
38
#include < utility>
@@ -821,6 +822,18 @@ int main(int argc, char const *argv[]) {
821
822
}
822
823
}
823
824
824
- SBDebugger::Terminate ();
825
+ // When terminating the debugger we have to wait on all the background tasks
826
+ // to complete, which can take a while. Print a message when this takes longer
827
+ // than 1 second.
828
+ {
829
+ std::future<void > future =
830
+ std::async (std::launch::async, []() { SBDebugger::Terminate (); });
831
+
832
+ if (future.wait_for (std::chrono::seconds (1 )) == std::future_status::timeout)
833
+ fprintf (stderr, " Waiting for background tasks to complete...\n " );
834
+
835
+ future.wait ();
836
+ }
837
+
825
838
return exit_code;
826
839
}
You can’t perform that action at this time.
0 commit comments