Re: libevent wrapper
| From: | Antony Dovgal | Date: | Fri, 28 Nov 2008 08:57:02 +0000 |
| Subject: | Re: libevent wrapper | ||
| References: | 1 2 3 4 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-5931@lists.php.net to get a copy of this message | ||
On 28.11.2008 09:59, Arnaud Le Blanc wrote:
> I just found a problem when an event resource is deleted while the callback is
> called (event_free() allows that).
Right, that's exactly why I do zend_list_addref(event->rsrc_id);
> It is possible to change the internal
> callback functions so that they do not need to use the the possibly freed
> memory after the call. This also makes them simpler by not attempting to avoid
> freeing the resources. The same problem applies for buffer and loop resources.
> I made a patch for that [1]
I'm afraid I don't understand a half of it.
>(for loops I had to add a counter of attached
> events and to fail in event_base_free() when the counter is > 0).
I don't think it's correct - each event does zend_list_addref() for the base
when the base is set and zend_list_delete() when the event is destroyed, so base
should have refcount == 1 after all events are destroyed.
--
Wbr,
Antony Dovgal