[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[Libevent-users] Are event_base's reference counted?
- To: libevent-users@xxxxxxxx
- Subject: [Libevent-users] Are event_base's reference counted?
- From: Jeffrey Walton <noloader@xxxxxxxxx>
- Date: Mon, 24 Feb 2014 21:02:28 -0500
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: libevent-users-outgoing@xxxxxxxx
- Delivered-to: libevent-users@xxxxxxxx
- Delivery-date: Mon, 24 Feb 2014 21:02:33 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:date:message-id:subject:from:to:content-type; bh=4mBHkt+oMYxCom/XauKSCdB7xv6gbeF//00kdb+ZGvU=; b=rc4BaBMo+OzIYiido7qGgPjgbxlrgG97HuODB0bTq1RdhS8L2n9qqACkKGkZjzpsVD CTPBNIRLu5rvrccpL5JTk+rAiVIYK1ePGisrwT+0jwOs6WgSv6dRVmq+BgFn7C3kq8AH bAswk04TnSTGoKMV5q+75Xv2O0kS4HE7iW+qFwFAoOZ38sTLl28wp4lgN84ufhWQIA2W 6VKreyqspveuzoZlzXQ3Y/X1Etl1Wb+bhrWspBgcetwY4iH14k+mUIWZla7OSNWatS+L Tq4hzl1fd7OPVt7eUYETBmAKys3rT+aLCBdkQUHcF7hBrdPCYgvfQwch8eEJw5tduW7x nyCQ==
- Reply-to: libevent-users@xxxxxxxxxxxxx
- Sender: owner-libevent-users@xxxxxxxxxxxxx
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.