summaryrefslogtreecommitdiffstats
path: root/core/dive.h
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2017-11-22 20:42:33 +0100
committerGravatar Robert C. Helling <helling@atdotde.de>2017-11-25 20:13:01 +0100
commit8e21a65653514d9340ef45c9b9c53dfe5d280350 (patch)
tree2ada40567e25bc45035698748f368127b1cca199 /core/dive.h
parenta9ceecc2e3646432d6688d04b592c48f9c63ae65 (diff)
downloadsubsurface-8e21a65653514d9340ef45c9b9c53dfe5d280350.tar.gz
Localize global planner state
For UI responsiveness, we need to be able to run the planner in the background. This needs the planner state to be localized (and we need to pass a pointer around). In order to not let too many lines overrun (and to save typing in the future) I have renamed instances of struct deco_state to ds. Yes this should have gone to a separate commit but I accidentally commit --amend'ed it. Computing of planner variations is temporarily disabled. Unlock the planner when returning early So we don't deadlock in add dive and recreational mode (which use the planner without actually planning). Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'core/dive.h')
-rw-r--r--core/dive.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/core/dive.h b/core/dive.h
index 81396d352..399feecb5 100644
--- a/core/dive.h
+++ b/core/dive.h
@@ -894,17 +894,17 @@ struct deco_state {
int deco_time;
};
-extern void add_segment(double pressure, const struct gasmix *gasmix, int period_in_seconds, int setpoint, const struct dive *dive, int sac);
-extern void clear_deco(double surface_pressure);
-extern void dump_tissues(void);
+extern void add_segment(struct deco_state *ds, double pressure, const struct gasmix *gasmix, int period_in_seconds, int setpoint, const struct dive *dive, int sac);
+extern void clear_deco(struct deco_state *ds, double surface_pressure);
+extern void dump_tissues(struct deco_state *ds);
extern void set_gf(short gflow, short gfhigh);
extern void set_vpmb_conservatism(short conservatism);
-extern void cache_deco_state(struct deco_state **datap);
-extern void restore_deco_state(struct deco_state *data, bool keep_vpmb_state);
-extern void nuclear_regeneration(double time);
-extern void vpmb_start_gradient();
-extern void vpmb_next_gradient(double deco_time, double surface_pressure);
-extern double tissue_tolerance_calc(const struct dive *dive, double pressure);
+extern void cache_deco_state(struct deco_state *source, struct deco_state **datap);
+extern void restore_deco_state(struct deco_state *data, struct deco_state *target, bool keep_vpmb_state);
+extern void nuclear_regeneration(struct deco_state *ds, double time);
+extern void vpmb_start_gradient(struct deco_state *ds);
+extern void vpmb_next_gradient(struct deco_state *ds, double deco_time, double surface_pressure);
+extern double tissue_tolerance_calc(struct deco_state *ds, const struct dive *dive, double pressure);
/* this should be converted to use our types */
struct divedatapoint {
@@ -940,9 +940,9 @@ struct decostop {
int depth;
int time;
};
-bool plan(struct diveplan *diveplan, struct dive *dive, int timestep, struct decostop *decostoptable, struct deco_state **cached_datap, bool is_planner, bool show_disclaimer);
-void calc_crushing_pressure(double pressure);
-void vpmb_start_gradient();
+bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, int timestep, struct decostop *decostoptable, struct deco_state **cached_datap, bool is_planner, bool show_disclaimer);
+void calc_crushing_pressure(struct deco_state *ds, double pressure);
+void vpmb_start_gradient(struct deco_state *ds);
void clear_vpmb_state();
void printdecotable(struct decostop *table);