I have have a problem with the Thread Termination ([C] - Linux). The problem is that I can not completely finish a thread and deallocate resources. Because if I recall the program, I see that the old thread is still running
The server code is more less like this:
int quit=0;
void* sending();
main(){
.......
pthread_t thread_send;
pthread_create(&thread_send, NULL, sending, NULL);
//pthread_join(thread_send); here is useful? the thread don't completely finish-
return 0;
}
void *sending(){
while(quit==0){
if(...){
quit=1;
}
}
//pthread_exit(NULL); here is useful ?
return 0;
}
How i can use pthred_exit() or pthred_kill(); or pthread_detach or pthread_join? I would like to terminate the thread properly and deallocating all the memory used by the thread.
thank you!