Son sonuçlara ulaşmak için birden fazla G/Ç borusu kullanan (her işlem için bir boru) bir mapceduce programı yazıyorum. İşlemleri oluştururken sorun yaşıyorum. Özellikle, aşağıdaki hatayı alıyorum: Ben threadFunction seçme kullanan bir iplikfork() - birden çok işlem ve sistem çağrısı
pthread_t newThread;
pthread_create(&newThread,NULL,threadFunction,values);
pthread_join(newThread,NULL);
oluşturma Bundan sonra
while (values[inc]!=NULL) //provided array of text lines
{
if ((pid = fork()) == -1) {
perror("fork error");
exit(EXIT_FAILURE);
}
else if (pid == 0) { /* start of child process */
printf("Child process...\n");
/* pipes[inc][1] is a file descriptor to which myMap writes some data
using the write() system call
mr is a struct that holds other function pointers */
mr->myMap(pipes[inc][1],values[inc]);
exit(0);
}
else { /* start of parent process */
printf("Parent process...\n");
if ((wpid = wait(&status)) == -1)
/* Wait for child process. */
perror("wait error");
else { /* Check status. */
if (WIFSIGNALED(status) != 0)
printf("Child process ended because of signal %d\n",
WTERMSIG(status));
else if (WIFEXITED(status) != 0)
printf("Child process ended normally; status = %d\n",
WEXITSTATUS(status));
else
printf("Child process did not end normally\n");
}
//close(fd[1]);
printf("Parent process ended\n");
}
inc++;
}
(:
wait error: Interrupted system call
Bu süreçler çoğaltılır benim kodudur) Hangi dosya tanıtıcısının okunmaya hazır olduğunu bulup, okuyarak veriyi bir sözlüke koyar.
formu gdb debugger program çıkışı çalıştırırken:
Parent process...
Child process...
wait error: Interrupted system call
Parent process ended
Parent process...
Child process ended normally; status = 0
Parent process ended
Parent process...
Child process...
Child process...
wait error: Interrupted system call
Parent process ended
Ben sorunu çözmek için nasıl bilmiyorum. Baska öneri?
Teşekkürler!
Ne demek istediğini emin değilim. Lütfen detaylandırın. – Krzysiek
@Rafcio Cevabımı güncelledim. – trojanfoe
Teşekkürler. Mantıklı! :) – Krzysiek