c++ - Linux socket programming: read data by SIGIO -


i coded program reading , writing gpio pins , receiving data through socket using datagram connection. wanted try read data socket when sigio signal received. when attempted that, reading / writing operations on gpio pins started failed. why happening?

if not activate gpio read/write operations throw sigio signal, not supposed receive sigio signal because of read/write operations on gpio pins. wrong? or io operations start directed signal handler?

here piece of code activated sigio signal socket.

int fd = socket( af_inet, sock_dgram, 0 ); ... struct sigaction sa; memset( &sa, 0, sizeof(struct sigaction) ); sigemptyset( &sa.sa_mask ); sa.sa_sigaction = signalhandler; sa.sa_flags = sa_restart | sa_siginfo; sigaction( sigio, &sa, null ); fcntl( fd, f_setown, getpid() ); fcntl( fd, f_setsig, sigio ); fcntl( fd, f_setfl, o_nonblock | o_async ); 

thanks.

note: code huge , written in oop concept. not seem possible copy code here. copied code related problem here. however, create mcve , copy here in moment. also, trying understand signal concept of linux. because implies have lack of understanding of signal concept or sigio behaviour.

sigio 1 big bucket can caused multiple different sources @ same time.

using select()/poll() in main loop better approach rely sigio


Comments