Basic structure of main.c:
int main ()
{
Open the file data.txt and obtain the file handler fh;
Create a thread my_thread using pthread_create; pass fh to my_thread;
Wait until my_thread terminates, using pthread_join;
Print out how many lines exist in data.txt.
}
Basic structure of thread_function.c:
void *count_lines(void *arg)
{
Obtain fh from arg;
Return num_lines
}
--------------------------------------------------------------
How can i pass file handler from main.c to thread_function.c