[Freeswitch-dev] Newbie question on switch_event_dup() with a code snippet

Anthony Minessale anthony.minessale at gmail.com
Wed Jun 30 06:44:58 PDT 2010


Yes cloned events must be destroyed for sure.

Better still what you should so in this case is use a fifo to deliver the
cloned event to another thread so you are not blocking in the event handler.
 You can then destroy it from there.



On Tue, Jun 29, 2010 at 10:03 PM, Paul Li <plite2012 at gmail.com> wrote:

> I guess you were assuming I would pass the event clone (pointer) to the
> core API (such as switch_event_fire), so that I would not need to free the
> clone pointer. I guess I still need to destroy it in the following scenario:
>
> static void my_event_handler(switch_event_t *event)
> {
>     switch_event_t *clone = NULL;
>
>    if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) {
>
>        /* use clone in my extended context */
>
>        switch_event_destroy(&clone);
>    }
> }
>
> > Anthony Minessale
> > Tue Jun 29 12:30:52 PDT 2010
> >
> > yes any functions that take pointers to pointers and leave you with null
> > will indicate you don't have to do anything.
> >
>
>
> _______________________________________________
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>
>


-- 
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
pstn:+19193869900
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20100630/b2bb2e90/attachment.html 


More information about the FreeSWITCH-dev mailing list