I just resolved a similar issue today, where I needed to close a file
descriptor AFTER deleting an event.

My symptoms, though, were different.

What underlying mechanism is your libevent using ?

In my case it is epoll. With select or poll my scenario had no problems, in
spite of the wrong order.

 

From: libevent-users-boun...@monkey.org
[mailto:libevent-users-boun...@monkey.org] On Behalf Of Clint Webb
Sent: Thursday, September 17, 2009 7:46 PM
To: libevent-users@monkey.org
Subject: [Libevent-users] Must delete events before closing the socket
handle

 

Hello everyone, 

 

After spending over a week debugging a project I am working on, I have
discovered that you must delete any persistent events BEFORE you close the
socket handle.

Just letting other people know who might not have noticed it before.

 

The symptom will be that the next time the same socket handle is assigned,
events will not fire when data arrives on the socket.   In some cases I was
getting segfaults.


I've attached some code that will echo what it receives.   It can be used to
demonstrate what happens.

 

 


-- 
"Be excellent to each other"

_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkeymail.org/mailman/listinfo/libevent-users

Reply via email to