You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
eio: Add '--eio-env-as-fiber-var'
Eio_main.run now also sets the variable if passed. It also creates a switch and initializes the sw variable if specified with --eio-sw-as-fiber-var.
let fd = Lwt_io.open_file ~mode:Lwt_io.input fname in
26
+
Lwt_io.close fd
27
+
17
28
let main () =
18
29
Fiber.fork
19
-
~sw:(Option.get (Fiber.get Fiber_var.sw))
30
+
~sw:(Stdlib.Option.get (Fiber.get Fiber_var.sw))
20
31
(fun () -> async_process 1);
21
32
let fd =
22
33
fun ?blocking:x1 ?set_flags:x2 ->
23
34
Eio_unix.Fd.of_unix
24
-
~sw:(Option.get (Fiber.get Fiber_var.sw))
35
+
~sw:(Stdlib.Option.get (Fiber.get Fiber_var.sw))
25
36
?blocking:x1 ~close_unix:true
26
37
(* TODO: lwt-to-direct-style: Labelled argument ?set_flags was dropped.*)
27
38
Unix.stdin
@@ -34,6 +45,8 @@ Make a writable directory tree:
34
45
35
46
let () =
36
47
Eio_main.run (fun env ->
37
-
(* TODO: lwt-to-direct-style: [Eio_main.run] argument used to be a [Lwt] promise andis now a [fun]. Make sure no asynchronous orIO calls are done outside of this [fun].*)
38
-
(* TODO: lwt-to-direct-style: Make sure to create a [Switch.t] and store it in fiber variable ["Fiber_var.sw"].*)
39
-
main ())
48
+
Fiber.with_binding Fiber_var.env env (fun () ->
49
+
Switch.run~name:"main" (fun sw ->
50
+
Fiber.with_binding Fiber_var.sw sw (fun () ->
51
+
(* TODO: lwt-to-direct-style: [Eio_main.run] argument used to be a [Lwt] promise andis now a [fun]. Make sure no asynchronous orIO calls are done outside of this [fun].*)
0 commit comments