]> git.kaiwu.me - klib.git/commitdiff
change the argument ordering
authorHeng Li <lh3@me.com>
Fri, 11 Oct 2013 13:34:42 +0000 (09:34 -0400)
committerHeng Li <lh3@me.com>
Fri, 11 Oct 2013 13:34:42 +0000 (09:34 -0400)
kthread.c
test/kthread_test.c

index b0d1346a33e58308da7ca1bb51a1c93c0188a6e9..43797eae8e0b19b9d05f5c30500fb47e0a3c50cb 100644 (file)
--- a/kthread.c
+++ b/kthread.c
@@ -39,7 +39,7 @@ static void *ktf_worker(void *data)
        pthread_exit(0);
 }
 
-void kt_for(int n_threads, void (*func)(void*,int,int), void *data, int n)
+void kt_for(int n_threads, int n, void (*func)(void*,int,int), void *data)
 {
        int i;
        kt_for_t t;
index 5e46ca954db89f3c4ee1a4e2bc51cefae2ee3dd0..1b67ed4ea4d6d2c599fc7ea1db232d8f818c16ae 100644 (file)
@@ -32,7 +32,7 @@ static void compute(void *_g, int i, int tid)
        g->k[i] = k;
 }
 
-void kt_for(int n_threads, void (*func)(void*,int,int), void *data, int n_items);
+void kt_for(int n_threads, int n_items, void (*func)(void*,int,int), void *data);
 
 int main(int argc, char *argv[])
 {
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
        global.k = calloc(tot, sizeof(int));
        for (i = 0; i < tot; ++i) global.k[i] = -1;
        if (type == 0) {
-               kt_for(n_threads, compute, &global, tot);
+               kt_for(n_threads, tot, compute, &global);
        } else if (type == 2) {
                #pragma omp parallel for
                for (i = 0; i < tot; ++i)