struct thread_state *ts = (struct thread_state *)arg;
char namebuf[64];
- sprintf(namebuf, "file-%d", ts->thread_num);
+ sprintf(namebuf, "file-%d", ts->thread_num + 1);
printf("Opening %s\n", namebuf);
int64_t start, end;
int main(int argc, char *argv[])
{
- for (int i = 0; i < 8; i++) {
+ int threads = 8;
+
+ if (argc > 1)
+ threads = atoi(argv[1]);
+ if (threads > MAX_THREADS)
+ threads = MAX_THREADS;
+
+ printf("Testing with %d threads\n", threads);
+
+ for (int i = 0; i < threads; i++) {
launch_thread(i);
}
- for (int i = 0; i < 8; i++) {
+ for (int i = 0; i < threads; i++) {
wait_thread(i);
}