On an embedded vision system prototype I am developing, using Linux kernel 2.6.18
the following socket server code extract
Code:
read_fd_set = active_fd_set;
if(select (FD_SETSIZE, &read_fd_set, NULL, NULL, NULL) < 0)
{
perror ("select");
exit (EXIT_FAILURE);
}
gave me the following problem
select: Interrupted system call
appereantly the thread died cause select was interrupted by a signal (might be a signal used by camera API??)
I have two questions:
(1)
why if I perform exit() not all the threads die?? POSIX says that whenever a thread performs exit() all processes should die!
(2)
Is the following a good correction or do I risk to loose some client request if a signal arrives in the mean time??
Code:
read_fd_set = active_fd_set;
while (select (FD_SETSIZE, &read_fd_set, NULL, NULL, NULL) < 0)
{
if (errno!=EINTR)
{
//checked that errno is on a per thread basis
perror ("select");
exit (EXIT_FAILURE);
}
else
{
perror("select");
printf("Reselecting\n");
}
}