I am new to pthread and I have gone through some tutorials. The tutorials say that I can pass only a single argument to a function used in thread. I solved the problem by using a structure for passing multiple arguments into the thread. But now on further study I came to the conclusion that a function in a thread can’t return any value and the only way to do that is the use of global variables. What I actually need is, I need two functions running in two different threads and the return value of one function need to the the input of the other and vice versa. What should I do to implement this need. Thanks in advance. And yes, linux is the platform.
Share
Check
pthread_join(). It will give value passed topthread_exit(). You can try passing the value topthread_exit()instead of returning from the thread_function.