Fix issue when re-using the main-thread and terminating the scheduler

4 jobs from master in 49 seconds (queued for 12 seconds)
Status Job ID Name Coverage
  Build
passed #3160
build_cmake

00:27

 
  Test
failed #3161
run_tests

00:22

 
  Sanitizer
skipped #3163
run_address_sanitizer
skipped #3162
run_thread_sanitizer
 
Test run_tests
                                       ^
app/benchmark_unbalanced/CMakeFiles/benchmark_unbalanced.dir/build.make:62: recipe for target 'app/benchmark_unbalanced/CMakeFiles/benchmark_unbalanced.dir/main.cpp.o' failed
make[2]: *** [app/benchmark_unbalanced/CMakeFiles/benchmark_unbalanced.dir/main.cpp.o] Error 1
CMakeFiles/Makefile2:411: recipe for target 'app/benchmark_unbalanced/CMakeFiles/benchmark_unbalanced.dir/all' failed
make[1]: *** [app/benchmark_unbalanced/CMakeFiles/benchmark_unbalanced.dir/all] Error 2
make: *** [all] Error 2
Makefile:140: recipe for target 'all' failed
./ci_scripts/run_tests.sh: line 9: ./bin/tests: No such file or directory
ERROR: Job failed: exit code 1