TACHE Prod(void) { puts("------> Start Prod"); while(1){ puts("------> Prod : je prod"); field = 1; puts("------> Prod : je reveille"); reveille(tacheC); puts("------> Prod : je dors"); dort(); } fin_tache(); }
TACHE Conso(void) { puts("------> Start Conso"); while(1){ puts("------> Conso : je dors"); dort(); puts("------> Conso : je mange"); field=0; puts("------> Conso : je reveille"); reveille(tacheP); } fin_tache(); }
void tc_rt(int stm , int checkip) { //printf("inside"); int ni=1; char type[10]; if(stm == -1) { printf("\n\t\t\tchecking on all the sreams\n"); for(ni=0;ni<=node_count;ni++) { printf("\t\tstream number = %d \n",ni); printf("\tclient side RT \n"); strcpy(type,"client"); dort(ni,type,delta); printf("\n\tserver sidee RT \n"); strcpy(type,"server"); dort(ni,type,delta); } } else { struct stream *stream_tst; stream_tst=stream_head; while(stream_tst != NULL && stream_tst->st_no != stm) { // printf("inside %d val%d or\n",stream_tst->st_no,stm); stream_tst=stream_tst->snext; } if(checkip >0) { if(!strcmp(stream_tst->src_ip,ip)) { printf("\t\tchecking for client side RT \n\n"); strcpy(type,"client"); dort(stm,type,delta); } else { printf("\t\tchecking for client side RT \n"); strcpy(type,""); strcpy(type,"server"); // printf("inside %d val%d or\n",stream_head->st_no,stm); dort(stm,type,delta); } } else if(checkip < 0) { printf("\t\tchecking for server sidee RT \n\n\n"); strcpy(type,"server"); //printf("inside %d val or\n",stream_head->st_no); dort(stm,type,delta); printf("\t\tchecking for client side RT \n"); strcpy(type,"client"); dort(stm,type,delta); } } }