Attached is a diff (independent of my rtsig patch) that allows you to specify a search order for libevent methods by putting a comma seperated list of method names in environment variable "EVENT_METHODS", which I find more graceful than dealing with n different EVENT_NOxxxx variables.
--- event.c.orig 2008-02-25 02:34:37.000000000 -0500 +++ event.c 2008-05-12 18:07:57.000000000 -0400 @@ -171,6 +171,7 @@ { int i; struct event_base *base; + char *event_methods; if ((base = calloc(1, sizeof(struct event_base))) == NULL) event_err(1, "%s: calloc", __func__); @@ -188,10 +189,39 @@ base->sig.ev_signal_pair[1] = -1; base->evbase = NULL; - for (i = 0; eventops[i] && !base->evbase; i++) { - base->evsel = eventops[i]; + event_methods = getenv("EVENT_METHODS"); + if (event_methods) { + char *mtemp = strdup(event_methods); + char *mp, *np; + + for (mp = mtemp; mp && !base->evbase; mp = np) { + int found = 0; + const struct eventop **opp; + + np = strchr(mp, ','); + if (np) + *np++ = '\0'; + for (opp = eventops; *opp; opp++) { + const struct eventop *op = *opp; + if (op->name && strcmp(mp, op->name) == 0) { + base->evsel = op; + base->evbase = base->evsel->init(base); + found = 1; + break; + } + } +#if 0 /* if EVENT_SHOW_METHOD env var set? */ + if (!found) + event_msgx("libevent %s not found", mp); +#endif - base->evbase = base->evsel->init(base); + } + } + else { + for (i = 0; eventops[i] && !base->evbase; i++) { + base->evsel = eventops[i]; + base->evbase = base->evsel->init(base); + } } if (base->evbase == NULL) _______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users