Rework threads to not be template based.

This allows us to more easily handle them and makes their interface closer to std::thread.
4 jobs from master in 39 seconds (queued for 2 seconds)
Status Job ID Name Coverage
  Build
passed #3316
build_cmake

00:22

 
  Test
failed #3317
run_tests

00:16

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