# HG changeset patch # User Paul Boddie # Date 1615502944 -3600 # Node ID 59297f82abbc8da8b1c1b71a463de2c166a936b8 # Parent 6bb6fd146175faac3ca84413af003b754bc300f9 Catch system_error sometimes thrown when starting threads. diff -r 6bb6fd146175 -r 59297f82abbc dstest_test_client.cc --- a/dstest_test_client.cc Mon Mar 08 00:47:31 2021 +0100 +++ b/dstest_test_client.cc Thu Mar 11 23:49:04 2021 +0100 @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -45,7 +46,7 @@ /* Test parameters unaffected by any capability limits. */ const unsigned int MAP_PAGES = 20; -const unsigned int REGION_ITERATIONS = 10; +const unsigned int REGION_ITERATIONS = 20; @@ -190,12 +191,26 @@ /* Start threads accessing all the files. */ + printf("Starting threads...\n"); + time_t t = time(NULL); int current = 0; + unsigned long errors = 0; for (fileid = 0; fileid < NUMBER_OF_FILES; fileid++) + { for (unsigned int start_page = 0; start_page < START_LIMIT; start_page++) - activities[current++] = new std::thread(activity_iterate, &contexts[fileid], fileid, start_page); + { + try + { + activities[current++] = new std::thread(activity_iterate, &contexts[fileid], fileid, start_page); + } + catch (const std::system_error &exc) + { + errors++; + } + } + } /* Wait for the threads. */ @@ -212,7 +227,7 @@ file_close(&contexts[fileid]); t = time(NULL) - t; - printf("Activities completed in %ld seconds.\n", t); + printf("Activities completed in %ld seconds (with %ld threads not started).\n", t, errors); return 0; }