This commit is contained in:
NikolajDanger
2021-11-02 11:49:41 +01:00
parent 9edf8edc55
commit aad5b42090
6 changed files with 6 additions and 23 deletions

View File

@@ -88,15 +88,12 @@ int main(int argc, char * const *argv) {
paths = &argv[2];
}
//printf("Initializing job queue\n");
job_queue_init(&q, 64);
pthread_t threads[num_threads];
for (int i = 0 ; i < num_threads ; i++) {
//printf("Initializing thread %i\n", i);
pthread_create(&threads[i], NULL, fauxgrep_thread, strdup(needle));
}
//printf("finished initializing threads\n");
// FTS_LOGICAL = follow symbolic links
// FTS_NOCHDIR = do not change the working directory of the process
@@ -117,7 +114,6 @@ int main(int argc, char * const *argv) {
case FTS_D:
break;
case FTS_F:
//printf("%s\n", p->fts_accpath);
job_queue_push(&q, strdup(p->fts_path));
break;
default:
@@ -125,12 +121,9 @@ int main(int argc, char * const *argv) {
}
}
//printf("done pusing jobs\n");
fts_close(ftsp);
job_queue_destroy(&q);
//printf("done destroying jobqueue\n");
for (int i = 0 ; i < num_threads ; i++) {
pthread_join(threads[i], NULL);