Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. typedef struct _canal{
  2. int channel[2];
  3. }canal;
  4.  
  5. canal array_pipes[processos];
  6.  
  7. /*Pipe para cada uma das posições do array*/
  8.  
  9. while(true) {
  10. FD_ZERO(&read_set);
  11. FD_SET(array_pipes[j].channel[0], &read_set);
  12. selectRet = select(array_pipes[j].channel[0]+1, &read_set, NULL, NULL, &t)
  13. if (selectRet < 0) {
  14. /* Error */
  15. //if ( errno != EINTR ) {
  16. // printf("True Error!\n");
  17. //}
  18. } else if (selectRet == 0) {
  19. /* Nothing to read */
  20. /* Should never happen!!! */
  21. } else {
  22. for (i=0; i < NUM_PROCESSES; i++) {
  23. if ( FD_ISSET(array_pipes[j].channel[0],&fdSet) ) {
  24. numRead++;
  25. //Código todo bacano aqui
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement