#include <stdio.h>

typedef struct handler_t handler_t;
typedef void (*handle_func)(handler_t*);
typedef int timer_handle_t;

struct handler_t {
	char*          id;
	handle_func    execute;
	timer_handle_t timer_handle;
	unsigned int   duration;
};

static void func1(handler_t* handler);
static void func2(handler_t* handler);
static void start_timer(timer_handle_t timer_handle, unsigned int duration);

static const timer_handle_t timer1 = 1;
static const timer_handle_t timer2 = 2;
static handler_t handler1 = {"hndl1", func1, timer1, 5};
static handler_t handler2 = {"hndl2", func2, timer2, 10};

static void start_timer(timer_handle_t timer_handle, unsigned int duration) {
	printf("starting timer %d with duration %u\n", timer_handle, duration);
}

static void func1(handler_t* handler) {
	printf("Handler %s executing function\n", handler->id);
	if (5 > 3) { // Some condition that is different from func2
		start_timer(handler->timer_handle, handler->duration);
	}
}

static void func2(handler_t* handler) {
	printf("Handler %s executing function\n", handler->id);
	if (1 < 4) { // Some condition that is different from func1
		start_timer(handler->timer_handle, handler->duration);
	}
}

int main(void) {
	handler_t* handlers[2] = {&handler1, &handler2};
	
	for (unsigned int i=0; i<2; ++i) {
		handlers[i]->execute(handlers[i]);
	}
	return 0;
}
