mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-02 08:57:19 -04:00
Add command line option -no-libevent
This commit is contained in:
parent
4c4717b82a
commit
f52e3187e3
@ -869,6 +869,10 @@ union option_info cmdline_options_info[] = {
|
|||||||
"configuration values to be used and disables saving of "
|
"configuration values to be used and disables saving of "
|
||||||
"runtime state files.")),
|
"runtime state files.")),
|
||||||
|
|
||||||
|
INIT_OPT_BOOL("", N_("Disable libevent"),
|
||||||
|
"no-libevent", 0, 0,
|
||||||
|
N_("Disables libevent.")),
|
||||||
|
|
||||||
INIT_OPT_CMDALIAS("", N_("Disable link numbering in dump output"),
|
INIT_OPT_CMDALIAS("", N_("Disable link numbering in dump output"),
|
||||||
"no-numbering", OPT_ALIAS_NEGATE, "document.dump.numbering",
|
"no-numbering", OPT_ALIAS_NEGATE, "document.dump.numbering",
|
||||||
N_("Prevents printing of link number in dump output.\n"
|
N_("Prevents printing of link number in dump output.\n"
|
||||||
|
@ -263,7 +263,7 @@ enable_libevent(void)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (0 /* disable_libevent */)
|
if (get_cmd_opt_bool("no-libevent"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if !defined(NO_FORK_ON_EXIT) && defined(HAVE_KQUEUE) && !defined(HAVE_EVENT_REINIT)
|
#if !defined(NO_FORK_ON_EXIT) && defined(HAVE_KQUEUE) && !defined(HAVE_EVENT_REINIT)
|
||||||
|
@ -46,40 +46,6 @@ get_timers_count(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
check_timers(timeval_T *last_time)
|
|
||||||
{
|
|
||||||
timeval_T now;
|
|
||||||
timeval_T interval;
|
|
||||||
struct timer *timer;
|
|
||||||
|
|
||||||
timeval_now(&now);
|
|
||||||
timeval_sub(&interval, last_time, &now);
|
|
||||||
|
|
||||||
foreach (timer, timers) {
|
|
||||||
timeval_sub_interval(&timer->interval, &interval);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (!list_empty(timers)) {
|
|
||||||
timer = timers.next;
|
|
||||||
|
|
||||||
if (timeval_is_positive(&timer->interval))
|
|
||||||
break;
|
|
||||||
|
|
||||||
del_from_list(timer);
|
|
||||||
/* At this point, *@timer is to be considered invalid
|
|
||||||
* outside timers.c; if anything e.g. passes it to
|
|
||||||
* @kill_timer, that's a bug. However, @timer->func
|
|
||||||
* and @check_bottom_halves can still call @kill_timer
|
|
||||||
* on other timers, so this loop must be careful not to
|
|
||||||
* keep pointers to them. (bug 868) */
|
|
||||||
timer->func(timer->data);
|
|
||||||
mem_free(timer);
|
|
||||||
check_bottom_halves();
|
|
||||||
}
|
|
||||||
|
|
||||||
timeval_copy(last_time, &now);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_EVENT_BASE_SET
|
#ifdef HAVE_EVENT_BASE_SET
|
||||||
extern struct event_base *event_base;
|
extern struct event_base *event_base;
|
||||||
@ -110,6 +76,46 @@ struct event *timer_event(struct timer *tm)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void
|
||||||
|
check_timers(timeval_T *last_time)
|
||||||
|
{
|
||||||
|
timeval_T now;
|
||||||
|
timeval_T interval;
|
||||||
|
struct timer *timer;
|
||||||
|
|
||||||
|
timeval_now(&now);
|
||||||
|
timeval_sub(&interval, last_time, &now);
|
||||||
|
|
||||||
|
foreach (timer, timers) {
|
||||||
|
timeval_sub_interval(&timer->interval, &interval);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!list_empty(timers)) {
|
||||||
|
timer = timers.next;
|
||||||
|
|
||||||
|
if (timeval_is_positive(&timer->interval))
|
||||||
|
break;
|
||||||
|
|
||||||
|
del_from_list(timer);
|
||||||
|
/* At this point, *@timer is to be considered invalid
|
||||||
|
* outside timers.c; if anything e.g. passes it to
|
||||||
|
* @kill_timer, that's a bug. However, @timer->func
|
||||||
|
* and @check_bottom_halves can still call @kill_timer
|
||||||
|
* on other timers, so this loop must be careful not to
|
||||||
|
* keep pointers to them. (bug 868) */
|
||||||
|
timer->func(timer->data);
|
||||||
|
#ifdef USE_LIBEVENT
|
||||||
|
mem_free(timer_event(timer));
|
||||||
|
#else
|
||||||
|
mem_free(timer);
|
||||||
|
#endif
|
||||||
|
check_bottom_halves();
|
||||||
|
}
|
||||||
|
|
||||||
|
timeval_copy(last_time, &now);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_event_for_timer(timer_id_T tm)
|
set_event_for_timer(timer_id_T tm)
|
||||||
{
|
{
|
||||||
@ -150,10 +156,8 @@ install_timer(timer_id_T *id, milliseconds_T delay, void (*func)(void *), void *
|
|||||||
assert(id && delay > 0);
|
assert(id && delay > 0);
|
||||||
|
|
||||||
#ifdef USE_LIBEVENT
|
#ifdef USE_LIBEVENT
|
||||||
{
|
|
||||||
unsigned char *q = mem_alloc(sizeof_struct_event + sizeof(struct timer));
|
unsigned char *q = mem_alloc(sizeof_struct_event + sizeof(struct timer));
|
||||||
new_timer = (struct timer *)(q + sizeof_struct_event);
|
new_timer = (struct timer *)(q + sizeof_struct_event);
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
new_timer = mem_alloc(sizeof(*new_timer));
|
new_timer = mem_alloc(sizeof(*new_timer));
|
||||||
#endif
|
#endif
|
||||||
@ -190,8 +194,9 @@ kill_timer(timer_id_T *id)
|
|||||||
del_from_list(timer);
|
del_from_list(timer);
|
||||||
|
|
||||||
#ifdef USE_LIBEVENT
|
#ifdef USE_LIBEVENT
|
||||||
if (event_enabled)
|
if (event_enabled) {
|
||||||
timeout_del(timer_event(timer));
|
timeout_del(timer_event(timer));
|
||||||
|
}
|
||||||
mem_free(timer_event(timer));
|
mem_free(timer_event(timer));
|
||||||
#else
|
#else
|
||||||
mem_free(timer);
|
mem_free(timer);
|
||||||
|
Loading…
Reference in New Issue
Block a user