I should have explained what I was thinking a little better: stream = php_stream_open_wrapper(...) // what if the connection aborts here? ZEND_REGISTER_RESOURCE(...)
Is the connection aborting asynchronous? If so, then we could lose the stream at any time prior or even during registration of the resource. So, what I was getting at is that the technique is nice, but if the allocation/registration process is not atomic, should we be doing it? I can see that it is better to do it this way rather than not do it at all, but that means that everywhere that streams are used (and any other resource-able allocated structure) we should be registering/unregistering resources, and that will make the code look more complicated than it really is/needs to be. So would it be better for the streams "subsystem" to keep track of the streams itself? Or even just register each stream as a resource during allocation of the stream? Like I said, because I don't knows how the connection handling works, I was curious and wondered if there could be or should be a better way. --Wez. On 18/03/02, "Zeev Suraski" <[EMAIL PROTECTED]> wrote: > At 13:04 18/03/2002, Wez Furlong wrote: > >I've noticed a couple of places in the code where ZEND_REGISTER_RESOURCE > >is used to remember to cleanup streams, and then deletes the list entry > >when it has completed what it was doing. > > > >It's a nice idea, but it doesn't feel safe to me (probably because > >I'm not 100% aware of the way that PHP handles the connection aborting), > > I'm not sure why you think it's unsafe..? That's one of the key advantages > of using the resource infrastructure. I can't see how streams are > different from any other resource. > > Zeev -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php