diff options
| -rw-r--r-- | turbowc.c | 6 | 
1 files changed, 4 insertions, 2 deletions
@@ -168,13 +168,15 @@ static int turbowc(const char *path, size_t num_threads)  		}  	} -	for (i = 0; i < num_threads; i++) { +	for (i = 0; i < num_threads - 1; i++) {  		int rv;  		rv = pthread_create(threads + i, NULL, thread_f, NULL);  		if (rv) {  			size_t j; +			perror("pthread_create"); +  			for (j = 0; j < i; j++)  				pthread_cancel(threads[j]); @@ -184,7 +186,7 @@ static int turbowc(const char *path, size_t num_threads)  	thread_f(NULL); -	for (i = 0; i < num_threads; i++) +	for (i = 0; i < num_threads - 1; i++)  		pthread_join(threads[i], NULL);  	data_pool.total += count_newlines(data_pool.cursor, data_pool.left);  | 
