[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[Libevent-users] Are event_base's reference counted?



I'm experimenting with timers. In the timer callback, I perform the
following (to exit after a few callbacks):

void timeout_cb(evutil_socket_t fd, short events, void *arg) {

    static int count = 0;
    int rc;

    event* timer = (event *) arg;
    AC_ASSERT(timer != NULL);
    if (timer == NULL) return;

    struct timeval tv = { WATCHDOG_TIMER_SECONDS, 0 };
    rc = event_add(timer, &tv);
    AC_ASSERT(rc == 0);

    count++;
    if (count == 3) {
        event_base* base = NULL;
        event_get_assignment(timer, &base, NULL, NULL, NULL, NULL);

        if (base) {
            struct timeval delay = { 1, 0 };
            rc = event_base_loopexit(base, &delay);
            AC_ASSERT(rc == 0);
        }
    }
}

Do I need to call event_base_free on the base returned from
event_get_assignment? The docs on event_get_assignment don't say what
needs to be done.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.