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

[Libevent-users] Equivalent of event_self_cbarg() in libevent-2.0?



Hi,

I had a signal handler which used libevent-1.4.x, and which looked
like this:

int main (void) {
  ...
  struct event sigev;
  memset(&sigev, 0, sizeof(sigev));
  event_set(&sigev, SIGINT, EV_SIGNAL|EV_PERSIST, sig_handler, &sigev);
  ...
  event_dispatch();
  return 0;
}

The sig_handler looked like:

static void sig_handler (int fd, short event, void *arg)
{
  struct event *signal = arg;
  event_del(signal);
  exit(1);
}

After porting it to libevent-2.0, the code in main() now looks like:

struct event *sigev;
sigev = evsignal_new(base, SIGINT, sig_handler, NULL);

I want to send the sigev as argument to the sig_handler. I read in
Nick's libevent book[*]  that this can be accomplished using
event_self_cbarg(), in 2.1.1-alpha+. Do we have something in
libevent-2.0.x for the same?

Thanks,
Chirag.

[*] http://www.wangafu.net/~nickm/libevent-book/Ref4_event.html





-- 
Chirag Kantharia, kantharia.in/chirag/
And all you touch and all you see, Is all your life will ever be.
                                -- Pink Floyd, Breathe

***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.