make kthread.c compiled with g++
This commit is contained in:
parent
1247dc2346
commit
c819643412
|
|
@ -130,14 +130,14 @@ void kt_pipeline(int n_threads, void *(*func)(void*, int, void*), void *shared_d
|
||||||
pthread_mutex_init(&aux.mutex, 0);
|
pthread_mutex_init(&aux.mutex, 0);
|
||||||
pthread_cond_init(&aux.cv, 0);
|
pthread_cond_init(&aux.cv, 0);
|
||||||
|
|
||||||
aux.workers = alloca(n_threads * sizeof(ktp_worker_t));
|
aux.workers = (ktp_worker_t*)alloca(n_threads * sizeof(ktp_worker_t));
|
||||||
for (i = 0; i < n_threads; ++i) {
|
for (i = 0; i < n_threads; ++i) {
|
||||||
ktp_worker_t *w = &aux.workers[i];
|
ktp_worker_t *w = &aux.workers[i];
|
||||||
w->step = 0; w->pl = &aux; w->data = 0;
|
w->step = 0; w->pl = &aux; w->data = 0;
|
||||||
w->index = aux.index++;
|
w->index = aux.index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
tid = alloca(n_threads * sizeof(pthread_t));
|
tid = (pthread_t*)alloca(n_threads * sizeof(pthread_t));
|
||||||
for (i = 0; i < n_threads; ++i) pthread_create(&tid[i], 0, ktp_worker, &aux.workers[i]);
|
for (i = 0; i < n_threads; ++i) pthread_create(&tid[i], 0, ktp_worker, &aux.workers[i]);
|
||||||
for (i = 0; i < n_threads; ++i) pthread_join(tid[i], 0);
|
for (i = 0; i < n_threads; ++i) pthread_join(tid[i], 0);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue