[C con Clase] Presentacion y consulta

Programante programante en gmail.com
Dom Ene 30 01:23:05 CET 2011


El 29/01/11 22:36, Stack Overflow escribió:
> Gracias por tu respuesta Gilberto
>
> El tema creo que viene por otro lado,
> Estoy haciendo un servidor que usa epoll. Y cuando quiero esperar por
> un evento, 
> llamo a la funcion epoll_wait
> El tema es que, por alguna razon (si alguien me puede aclarar porque),
> cuando ejecuto 
> desde gdb, la funcion termina como si hubiera un error EINTR.
> Pero esta es una situacion, al parecer, conocida. Y vi ejemplos donde
> especificamente se
> pregunta si el error es EINTR, que vuelva a ejecutar la funcion
> epoll_wait.
>
> Con esto puedo evitar la excepcion dentro de gdb.
>
> Saludos
Eso te pasa por no comprobar si las funciones devolvieron un error :)
Cuando gdb se une a un proceso lo "para", lo cual interrumpe la llamada
al sistema epoll_wait,
que entonces devuelve EINTR.

Te copio de signal(7):
> Interruption of System Calls and Library Functions by Stop Signals
>        On  Linux,  even  in  the  absence of signal handlers, certain
> blocking interfaces can fail with the error EINTR after the
>        process is stopped by one of the stop signals and then resumed
> via SIGCONT.  This behavior is not sanctioned  by  POSIX.1,
>        and doesn't occur on other systems.
>
>        The Linux interfaces that display this behavior are:
>
>            * Socket  interfaces,  when a timeout has been set on the
> socket using setsockopt(2): accept(2), recv(2), recvfrom(2),
>              and recvmsg(2), if a receive timeout (SO_RCVTIMEO) has
> been set; connect(2), send(2), sendto(2), and sendmsg(2),  if
>              a send timeout (SO_SNDTIMEO) has been set.
>
>            * epoll_wait(2), epoll_pwait(2).
>
>            * semop(2), semtimedop(2).
>
>            * sigtimedwait(2), sigwaitinfo(2).
>
>            * read(2) from an inotify(7) file descriptor.
>
>            * Linux 2.6.21 and earlier: futex(2) FUTEX_WAIT,
> sem_timedwait(3), sem_wait(3).
>
>            * Linux 2.6.8 and earlier: msgrcv(2), msgsnd(2).
>
>            * Linux 2.4 and earlier: nanosleep(2).






Más información sobre la lista de distribución Cconclase