| 30 | } |
| 31 | |
| 32 | int main() { |
| 33 | // This test should be run with a prewarmed pool of size 50. They should be fully allocated. |
| 34 | assert(EM_ASM_INT(return PThread.unusedWorkers.length) == 50); |
| 35 | |
| 36 | double total = 0; |
| 37 | for (int i = 0; i < 10; ++i) { |
| 38 | double t1 = emscripten_get_now(); |
| 39 | for (int j = 0; j < 50; ++j) { |
| 40 | CreateThread(j); |
| 41 | } |
| 42 | double t2 = emscripten_get_now(); |
| 43 | printf("Took %f ms to allocate 50 threads.\n", t2 - t1); |
| 44 | total += (t2 - t1); |
| 45 | // Join all the threads to clear the queue.. |
| 46 | for (int j = 0; j < 50; ++j) { |
| 47 | JoinThread(j); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | printf("Final average %f ms.\n", total / 10.0); |
| 52 | return 0; |
| 53 | } |
nothing calls this directly
no test coverage detected