On Sat, 2003-09-20 at 01:52, Curt Zirzow wrote:
> * Thus wrote Robert Cummings ([EMAIL PROTECTED]):
> > I wanted t play around with the CGI (not CLI) version of PHP and get a
> > feel for the I/O stuff, specifically STDIN. So I whipped up the
> > following script:
> > 
> > ///////////////////////////////////////////////////////////////////
> > 
> > #!/usr/bin/php -qC
> > <?
> >   
> >     if( ($stdin = fopen( 'php://stdin', 'r' )) === false )
> >     {                                                     
> >         echo 'Failed to open STDIN'."\n";
> >         exit();
> >     }          
> >      
> >     stream_set_blocking( $stdin, false );
> 
> I believe this is not needed, stdin is nonblocking all the time.

My original test script didn't set the blocking state to non blocking. I
determined from that that stdin is initally in a blocking state. Since I
typed several characters and none where printed till I hit enter.

> 
> >                                          
> >     $count = 0;                          
> >     while( 1 ) 
> 
> this will never exit until php runs out of memory, and most likely
> will lead to unexpected results.

Yeah, it was just a test script. But still, if the memory had been
exhausted, it wouldn't be in under a second, and I'd get a core dump
like I usually do when I have a runaway recursive function.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to