]> git.kaiwu.me - klib.git/commitdiff
no effective changes
authorHeng Li <lh3@me.com>
Wed, 9 Oct 2013 15:50:27 +0000 (11:50 -0400)
committerHeng Li <lh3@me.com>
Wed, 9 Oct 2013 15:50:27 +0000 (11:50 -0400)
kthread.c

index 52288d91eb19679648aa7b4b3e8b278868958cc2..7df20e2c9ad64a8f44a712d9b2a549291057b669 100644 (file)
--- a/kthread.c
+++ b/kthread.c
@@ -136,11 +136,8 @@ void kt_for(int n_threads, int (*func)(void*,void*), void *shared, int n_items,
        f->func = func;
 
        f->w = (ktf_worker_t*)calloc(f->n, sizeof(ktf_worker_t));
-       for (i = 0; i < f->n; ++i) {
-               ktf_worker_t *wi = &f->w[i];
-               wi->f = f, wi->i = i;
-               wi->q = dq_init(dq_bits);
-       }
+       for (i = 0; i < f->n; ++i)
+               f->w[i].f = f, f->w[i].i = i, f->w[i].q = dq_init(dq_bits);
 
        tid = (pthread_t*)calloc(f->n, sizeof(pthread_t));
        for (i = 0; i < f->n; ++i) pthread_create(&tid[i], 0, ktf_worker, &f->w[i]);