WIP: Call reset method on global async objects
It will probably be necessary to disable interrupts before calling the reset method.
This commit is contained in:
parent
215b602383
commit
e23fce0285
2 changed files with 16 additions and 0 deletions
|
@ -31,3 +31,12 @@ let async_global_objs_decls cd =
|
|||
(fun (name, ty) -> Cdecl_extern (name, ty))
|
||||
(async_global_objs_vars cd)
|
||||
|
||||
let async_reset cd =
|
||||
List.map
|
||||
(fun od ->
|
||||
let global = Cvar (async_global_var_name od) in
|
||||
let field = Cfield (global, local_qn "mem") in
|
||||
let reset = cname_of_qn od.o_class ^ "_reset" in
|
||||
Csexpr (Cfun_call (reset, [Caddrof field])))
|
||||
(filter_async_objs cd)
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ open Types
|
|||
open Signature
|
||||
open C
|
||||
open Cgen
|
||||
open Async
|
||||
open Compiler_utils
|
||||
|
||||
(** {1 Main C function generation} *)
|
||||
|
@ -405,6 +406,12 @@ let mk_main name p =
|
|||
(defs, nvar_l @ var_l, res @ res_l, nstep_l @ step_l)
|
||||
with Not_found -> ([],var_l,res_l,step_l) in
|
||||
|
||||
let res_l = List.fold_left
|
||||
(fun res cd -> (async_reset cd) @ res)
|
||||
res_l
|
||||
classes
|
||||
in
|
||||
|
||||
[("_main.c", Csource (defs @ [main_skel var_l res_l step_l]));
|
||||
("_main.h", Cheader ([name], []))];
|
||||
) else
|
||||
|
|
Loading…
Reference in a new issue