mirror of
https://github.com/c-cube/moonpool.git
synced 2026-05-05 17:04:33 -04:00
support for lwt.6
This commit is contained in:
parent
e2fb26b7fa
commit
a0f4c20f2b
6 changed files with 46 additions and 2 deletions
3
.github/workflows/main.yml
vendored
3
.github/workflows/main.yml
vendored
|
|
@ -55,8 +55,11 @@ jobs:
|
||||||
# temporary until it's in a release
|
# temporary until it's in a release
|
||||||
- run: opam pin https://github.com/ocaml-multicore/picos.git -y -n
|
- run: opam pin https://github.com/ocaml-multicore/picos.git -y -n
|
||||||
|
|
||||||
|
- run: opam pin -y -n lwt 5.9.2
|
||||||
- run: opam install -t moonpool moonpool-lwt --deps-only
|
- run: opam install -t moonpool moonpool-lwt --deps-only
|
||||||
- run: opam exec -- dune build @install
|
- run: opam exec -- dune build @install
|
||||||
|
|
||||||
# install some depopts
|
# install some depopts
|
||||||
|
- run: opam pin -y -n lwt 6.1.1
|
||||||
- run: opam install thread-local-storage trace domain-local-await
|
- run: opam install thread-local-storage trace domain-local-await
|
||||||
- run: opam exec -- dune build --profile=release --force @install @runtest
|
- run: opam exec -- dune build --profile=release --force @install @runtest
|
||||||
|
|
|
||||||
12
src/lwt/dune
12
src/lwt/dune
|
|
@ -3,8 +3,20 @@
|
||||||
(public_name moonpool-lwt)
|
(public_name moonpool-lwt)
|
||||||
(enabled_if
|
(enabled_if
|
||||||
(>= %{ocaml_version} 5.0))
|
(>= %{ocaml_version} 5.0))
|
||||||
|
(modules moonpool_lwt types_)
|
||||||
(libraries
|
(libraries
|
||||||
(re_export moonpool)
|
(re_export moonpool)
|
||||||
picos
|
picos
|
||||||
(re_export lwt)
|
(re_export lwt)
|
||||||
lwt.unix))
|
lwt.unix))
|
||||||
|
|
||||||
|
(executable
|
||||||
|
(name gen_types_)
|
||||||
|
(modules gen_types_))
|
||||||
|
|
||||||
|
(rule
|
||||||
|
(enabled_if %{lib-available:lwt})
|
||||||
|
(deps types_.ml.5 types_.ml.6)
|
||||||
|
(target types_.ml)
|
||||||
|
(action
|
||||||
|
(run ./gen_types_.exe %{version:lwt})))
|
||||||
|
|
|
||||||
23
src/lwt/gen_types_.ml
Normal file
23
src/lwt/gen_types_.ml
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
let copy_file src dst =
|
||||||
|
let ic = open_in src in
|
||||||
|
let oc = open_out dst in
|
||||||
|
let buf = Bytes.create 1024 in
|
||||||
|
(try
|
||||||
|
while true do
|
||||||
|
let n = input ic buf 0 (Bytes.length buf) in
|
||||||
|
if n = 0 then raise End_of_file;
|
||||||
|
output oc buf 0 n
|
||||||
|
done
|
||||||
|
with End_of_file -> ());
|
||||||
|
close_in ic;
|
||||||
|
close_out oc
|
||||||
|
|
||||||
|
let () =
|
||||||
|
let version = Sys.argv.(1) in
|
||||||
|
let major =
|
||||||
|
try Scanf.sscanf version "%d.%s" (fun maj _ -> maj) with _ -> 0
|
||||||
|
in
|
||||||
|
if major >= 6 then
|
||||||
|
copy_file "types_.ml.6" "types_.ml"
|
||||||
|
else
|
||||||
|
copy_file "types_.ml.5" "types_.ml"
|
||||||
|
|
@ -23,7 +23,7 @@ module Scheduler_state = struct
|
||||||
mutable as_runner: Moonpool.Runner.t;
|
mutable as_runner: Moonpool.Runner.t;
|
||||||
mutable enter_hook: Lwt_main.Enter_iter_hooks.hook option;
|
mutable enter_hook: Lwt_main.Enter_iter_hooks.hook option;
|
||||||
mutable leave_hook: Lwt_main.Leave_iter_hooks.hook option;
|
mutable leave_hook: Lwt_main.Leave_iter_hooks.hook option;
|
||||||
mutable notification: int;
|
mutable notification: Types_.notification;
|
||||||
(** A lwt_unix notification to wake up the event loop *)
|
(** A lwt_unix notification to wake up the event loop *)
|
||||||
has_notified: bool Atomic.t;
|
has_notified: bool Atomic.t;
|
||||||
}
|
}
|
||||||
|
|
@ -42,7 +42,7 @@ module Scheduler_state = struct
|
||||||
as_runner = Moonpool.Runner.dummy;
|
as_runner = Moonpool.Runner.dummy;
|
||||||
enter_hook = None;
|
enter_hook = None;
|
||||||
leave_hook = None;
|
leave_hook = None;
|
||||||
notification = 0;
|
notification = Types_.dummy_notification;
|
||||||
has_notified = Atomic.make false;
|
has_notified = Atomic.make false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
3
src/lwt/types_.ml.5
Normal file
3
src/lwt/types_.ml.5
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
type notification = int
|
||||||
|
let dummy_notification : notification = 0
|
||||||
3
src/lwt/types_.ml.6
Normal file
3
src/lwt/types_.ml.6
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
type notification = Lwt_unix.notification
|
||||||
|
let dummy_notification : notification = Lwt_unix.make_notification ignore
|
||||||
Loading…
Add table
Reference in a new issue