Subj : redundant functions - beginner To : comp.programming.threads From : Pasacco Date : Mon Mar 14 2005 03:33 am Dear I need some remark from experienced one. Regarding parameter passing, when we send (pointer of) multiple arrays to thread function, we have to pass (pointer of) the structure, if this is correct. My preliminary program looks like below ; we have initially 8 arrays and I am doing some permutations (and sorting, etc) for each array. The code size became is too big, compared to sequential program. It seems inefficient, because we have to pass the whole structure to each thread function. In case this is not a good program, let me know why, how can we solve this...:) Thankyou /**************************************/ .. .. struct par{ int *a0, *a1, *a2, *a3, *a4, *a5, *a6, *a7; // 8 arrays int *a0N,*a1N,*a2N,*a3N,*a4N,*a5N,*a6N,*a7N; // size of each }arrays; .. .. int main(int argc, char* argv[]) { . . thread_id1 = pthread_create(&thread1, NULL, &func12, &arrays); . . thread_join(thread1, NULL); thread_id2 = pthread_create(&thread2, NULL, &func34, &arrays); . . thread_join(thread2, NULL); . . } void* func12(void* parameters) { struct par* temp = (struct par*)parameters; . . // split a0[] into a1[] and a2[] split(temp->a0, temp->a1, temp->a2); . . } // Actually func34 and func12 are functionally the same. // Only the parameters sent are different. void* func34(void* parameters) { struct par* temp = (struct par*)parameters; . . // split a1[] into a3[] and a4[] split(temp->a1, temp->a3, temp->a4); . . } .. .. /**************************************/ .