I have seen code for summation of an array using threads. In this code a thread is created and an int data type is returned:
int iret1, iret2;
iret1 = pthread_create( &thread1, NULL, print_message_function, (void*) message1);
iret2 = pthread_create( &thread2, NULL, print_message_function, (void*) message2);
I knew that a thread is a child of a process and it uses for executing program. For the executing program memory is needed, and memory is returned by a void* data type.
What is the logical reason for returning an int? Can any one explain the actual reason?
According to
man pthread_create:That value simply indicates whether the thread creation was successful or not.
It is not a memory allocation call like
malloc, therefore I don’t see why you think it should return a pointer.