On Sun, Nov 04, 2007 at 09:37:52PM -0800, Scott Lamb wrote: > For this program, it's important to know more than that an error has > occurred. EV_ERROR is totally inadequate. You're using it for several > different cases. I spotted at least these three: > > * malloc() failed in ev_once - transient runtime error. > * select() failed with ENOMEM, so libev chose to kill this file > descriptor and now is notifying userspace. > * bad file descriptor - probably a logic error. > > What is my program supposed to do? It can't distinguish them, and the > correct behavior in each of these conditions is totally different. Also, > in the program I'm thinking of, "libev chose to kill this file > descriptor" probably means a network link just went down. Ergh.
Great point. It should back away and leave things alone - notifying to the caller (or whoever else is listening) "this is not acceptable to me - I suggest you fix it - because I won't" (aka unix way). > No, on error your library may have muddied the water already by screwing > with the file descriptors. libevent also makes errors clearer by simply > returning error from the failed function (I'm thinking of event_once() > vs ev_once() here.) Agreed. A library should touch as little as necessary to get the job done. -cl _______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://monkey.org/mailman/listinfo/libevent-users