Re: stream_select problem with signals

From: Date: Fri, 15 Feb 2008 14:02:24 +0000
Subject: Re: stream_select problem with signals
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-269363@lists.php.net to get a copy of this message
Marcos Lois Bermúdez wrote:
I'm rewriting an API to access OneWire Net, i have a problem with select and signals. The class will support both types of sockets, trought BSD sockets and with streams. My problem is that when the PHP app is in socket select and a signal arrives it threat it as a error, so i can fix in socket_select using socket_last_error in this form:
    $n = socket_select($_read, $_write, $_except, $sec, $usec);
               if($n === false) {
                   if(socket_last_error($this->_sock) == 0) {
                       // signal break the select
                       $timeout -= (microtime(true) - $start);
                   } else {
                       // Error, not interrupted by signal
                       return false;
                   }
               } else {
                   return $n;
               }
This work, but i can't determine if a signal interrupted the stream_select, there is a way to detect this? Regards.
socket_strerror(socket_last_error()) maybe?

« previous php.general (#269363) next »