Re: pcntl - class callbacks // dio ASYNC
| From: | Jason T. Greene | Date: | Mon, 12 Aug 2002 13:43:29 +0000 |
| Subject: | Re: pcntl - class callbacks // dio ASYNC | ||
| References: | 1 2 3 4 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-86739@lists.php.net to get a copy of this message | ||
Ok, I will take a look at that. Thanks for the patch, class callbacks
were actually on my todo list. I just haven't had much time to work on
php lately, but I will work on merging it with the following features:
ticks back-end replacement
system call interruption ability
-Jason
On Mon, 2002-08-12 at 08:38, Alan Knowles wrote:
> Jason T. Greene wrote:
>
> >Doesn't this currently work without your patch?
> >
> it does if we add O_ASYNC to the defines in dio
>
> the pcntl patch just fixes class based callbacks.. *the memory leaks I
> mentioned earlier where due to creating the signal connections before
> forking. - works OK if you connect the signals after forking.
>
> regards
> alan
>
>
> >
> >-Jason
> >
> >
> >On Thu, 2002-08-08 at 02:49, Alan Knowles wrote:
> >
> >
> >>this efree needs removing..
> >>
> >>
> >>
> >>>
> >>>+
> >>>+ efree(*call_name);
> >>>+ DEBUG_OUT("done call_user function\n");
> >>>+ /*call_user_function(EG(function_table), NULL, call_name,
> >>>&retval, 1, ¶m TSRMLS_CC); */
> >>> }
> >>>
> >>>
> >>>
> >>>
> >>I can now use the dio with ASYNC like this..
> >>
> >><?
> >>
> >>dl('dio.so');
> >>
> >>
> >>/* signal callbacks
> >>....
> >>*/
> >>
> >>function got_data() {
> >> global $fd;
> >> $data = dio_read($fd,256);
> >>
> >> if ($data) {
> >> echo $data;
> >> }
> >>
> >>}
> >>
> >>$fd = dio_open('/dev/ttyS0', O_RDWR | O_NOCTTY | O_NONBLOCK);
> >>
> >>dio_fcntl($fd,F_SETOWN,posix_getpid());
> >>dio_fcntl($fd,F_SETFL, O_ASYNC );
> >>//dio_fcntl($fd,F_SETFL, O_SYNC );
> >>pcntl_signal(SIGIO, 'got_data');
> >>
> >>dio_tcsetattr($fd, array(
> >> 'baud' => 9600,
> >> 'bits' => 8,
> >> 'stop' =>1,
> >> 'parity' => 0
> >>));
> >>echo "STARTING READ";
> >>while (1) {
> >> usleep(1)
> >>}
> >>
> >>?>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
> >
>
>
>