From: Brian Norris Date: Mon, 12 Mar 2012 22:51:56 +0000 (-0700) Subject: model: add global model_checker initialization X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=443c3b5f3962dbd4d5607a11d9c41ececf854e2c;p=cdsspec-compiler.git model: add global model_checker initialization --- diff --git a/model.c b/model.c index 0e1234c..ac50e3e 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 73c3d0c..e075ea2 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__ */