On Mon, Mar 20, 2017 at 8:44 AM, Sakthivel Subramaniam
<sakthive...@aximsoft.com> wrote:
> Hi,

Hi,

Could you please avoid:
- using html in your messages
- edit Cc:/To:
- and top-posting

> 1. currently I'm using event_free() for cleaning events. Is this fine or any
> other call is available to remove particular event?

Why do you need more if you already have one API for this?

But here are some differences between event_free() and event_del():
  
http://libevent-users.monkey.narkive.com/GsU2FrYK/infinite-loop-in-evmap-io-active#post4

And also worth reading:
  http://www.wangafu.net/~nickm/libevent-book/Ref4_event.html

> 2. When I try to create an event with event_new() of a socket id(accepted
> client ), in-case already event was created for same socket id. Why
> event_new is not throwing any error and its creating new event with that id
> again?

event_new() does not add any events for monitoring, it just prepares
the structure.

event_add() is the one that actually adds event for monitoring, but
anyway it doesn't return an error, and indeed epoll for instance
doesn't allow monitoring the same fd twice (EEXIST), libevent accept
it, and the reason I can come up with, to trigger multiple callbacks
for the activity on one fd, to avoid hooking into first added
callback.

BTW it was changed long time ago in 1.1:
  
https://github.com/libevent/libevent/commit/02b2b4d1bee7dfd5d75d0a376ce64fc7298e350f
***********************************************************************
To unsubscribe, send an e-mail to majord...@freehaven.net with
unsubscribe libevent-users    in the body.

Reply via email to