Store count of how many times a hook is fired and the last time.

This commit is contained in:
nicm
2026-07-27 19:15:58 +00:00
committed by tmux update bot
parent f751d3f2c1
commit 27ab96b284
6 changed files with 128 additions and 20 deletions

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: options.c,v 1.91 2026/07/23 09:38:27 nicm Exp $ */
/* $OpenBSD: options.c,v 1.92 2026/07/27 19:15:58 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -107,7 +107,10 @@ struct options_entry {
int cached;
struct style style;
void *monitor_data;
u_int fire_count;
time_t fire_time;
RB_ENTRY(options_entry) entry;
};
@@ -440,6 +443,25 @@ options_set_monitor_data(struct options_entry *o, void *data)
o->monitor_data = data;
}
void
options_hook_fired(struct options_entry *o)
{
o->fire_count++;
o->fire_time = current_time;
}
u_int
options_get_fire_count(struct options_entry *o)
{
return (o->fire_count);
}
time_t
options_get_fire_time(struct options_entry *o)
{
return (o->fire_time);
}
const struct options_table_entry *
options_table_entry(struct options_entry *o)
{