fzy
terminal fuzzy finder picker
git clone https://9o.is/git/fzy.git
commit a3a1186e7c7f53a40acdbfceebca9bc8975aa335 parent 288dfd7c2436f7acdbcad63feea9581526603a4e Author: John Hawthorn <john.hawthorn@gmail.com> Date: Wed, 22 Jun 2016 21:43:37 -0700 Use threading when matching/scoring Diffstat:
| M | src/choices.c | | | 9 | +++------ |
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/choices.c b/src/choices.c @@ -1,6 +1,7 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#include <pthread.h> #include "choices.h" #include "match.h" @@ -134,8 +135,6 @@ size_t choices_available(choices_t *c) { return c->available; } -#include <pthread.h> - struct worker { pthread_t thread_id; choices_t *choices; @@ -182,8 +181,7 @@ void choices_search(choices_t *c, const char *search) { workers[i].worker_count = worker_count; workers[i].worker_num = i; workers[i].results = malloc(c->size * sizeof(struct scored_result)); /* FIXME: This is overkill */ - int ret = pthread_create(&workers[i].thread_id, NULL, &choices_search_worker, &workers[i]); - if (ret != 0) { + if (pthread_create(&workers[i].thread_id, NULL, &choices_search_worker, &workers[i])) { perror("pthread_create"); exit(EXIT_FAILURE); } @@ -192,8 +190,7 @@ void choices_search(choices_t *c, const char *search) { for (int i = 0; i < worker_count; i++) { struct worker *w = &workers[i]; - int ret = pthread_join(w->thread_id, NULL); - if (ret != 0) { + if (pthread_join(w->thread_id, NULL)) { perror("pthread_join"); exit(EXIT_FAILURE); }