Obsolete
/
libipc-old
Archived
3
0
Fork 0

server pingpong create thread for new client and exit thread when receive 0

more_to_read
lapupe 2016-09-28 19:30:53 +02:00
parent 716a6d1197
commit b311fab73e
1 changed files with 3 additions and 2 deletions

View File

@ -27,6 +27,7 @@ void * pongd_thread(void * pdata) {
fprintf(stdout, "MAIN_LOOP: error service_write %d\n", ret); fprintf(stdout, "MAIN_LOOP: error service_write %d\n", ret);
} }
}else { }else {
printf("------thread shutdown------------\n");
break; break;
} }
} }
@ -65,8 +66,8 @@ void main_loop (const struct service *srv)
} }
srv_process_print (&tab_proc[cnt]); srv_process_print (&tab_proc[cnt]);
//printf ("after print\n");
printf ("\n-------New thread created---------\n");
int ret = pthread_create( &tab_thread[cnt], NULL, &pongd_thread, (void *) &tab_proc[cnt]); int ret = pthread_create( &tab_thread[cnt], NULL, &pongd_thread, (void *) &tab_proc[cnt]);
if (ret) { if (ret) {
perror("pthread_create()"); perror("pthread_create()");