From 443c3b5f3962dbd4d5607a11d9c41ececf854e2c Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Mon, 12 Mar 2012 15:51:56 -0700 Subject: [PATCH] model: add global model_checker initialization --- model.c | 22 ++++++++++++++++++++++ model.h | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/model.c b/model.c index 0e1234cd..ac50e3e7 100644 --- a/model.c +++ b/model.c @@ -1 +1,23 @@ #include "model.h" +#include "schedule.h" +#include +#include + +struct model_checker *model; + +void model_checker_init(void) +{ + model = malloc(sizeof(*model)); + memset(model, 0, sizeof(*model)); + scheduler_init(model); +} + +void model_checker_exit(void) +{ + struct scheduler *sched = model->scheduler; + + if (sched->exit) + sched->exit(); + free(sched); + free(model); +} diff --git a/model.h b/model.h index 73c3d0c0..e075ea25 100644 --- a/model.h +++ b/model.h @@ -5,4 +5,8 @@ struct model_checker { struct scheduler *scheduler; }; +extern struct model_checker *model; + +void model_checker_init(void); + #endif /* __MODEL_H__ */ -- 2.34.1