1+ open Eio.Std
2+
13(* Ocsigen
24 * Copyright (C) 2009
35 *
2224 @author Raphaël Proust (adding timers)
2325*)
2426
25- open Lwt.Infix
26-
2727module Dlist : sig
2828 type 'a t
2929 type 'a node
@@ -120,7 +120,7 @@ end = struct
120120 ; mutable finaliser_after : 'a node -> unit
121121 ; time_bound : time_bound option }
122122
123- and time_bound = {timer : float ; mutable collector : unit Lwt .t option }
123+ and time_bound = {timer : float ; mutable collector : unit Promise .t option }
124124
125125 (* Checks (by BY):
126126
@@ -214,7 +214,7 @@ end = struct
214214 | None -> assert false (* collection is set to None and collector to Some *)
215215 | Some t ->
216216 let duration = t -. Unix. gettimeofday () in
217- if duration < = 0. then Lwt. return () else Lwt_unix . sleep duration
217+ if duration < = 0. then () else Eio_unix . sleep duration
218218
219219 (* a function to set the collector. *)
220220 let rec update_collector r =
@@ -227,11 +227,10 @@ end = struct
227227 | Some n ->
228228 t.collector < -
229229 Some
230- ( sleep_until n.collection >> = fun () ->
231- collect r n;
232- t.collector < - None ;
233- update_collector r;
234- Lwt. return () ))
230+ (sleep_until n.collection;
231+ collect r n;
232+ t.collector < - None ;
233+ update_collector r))
235234
236235 (* Add a node that do not belong to any list to a list.
237236 The fields [succ] and [prev] are overridden.
@@ -399,7 +398,7 @@ functor
399398 type t =
400399 { mutable pointers : A .key Dlist .t
401400 ; mutable table : (A .value * A .key Dlist .node ) H .t
402- ; finder : A .key -> A .value Lwt .t
401+ ; finder : A .key -> A .value
403402 ; clear : unit -> unit
404403 (* This function clears the cache. It is put inside the
405404 cache structure so that it is garbage-collected only when the cache
@@ -460,14 +459,14 @@ functor
460459 let size c = Dlist. size c.pointers
461460
462461 let find cache k =
463- try Lwt. return ( find_in_cache cache k)
462+ try find_in_cache cache k
464463 with Not_found ->
465- cache.finder k >> = fun r ->
464+ let r = cache.finder k in
466465 (try
467466 (* it may have been added during cache.finder *)
468467 ignore (find_in_cache cache k : A.value )
469468 with Not_found -> add_no_remove cache k r);
470- Lwt. return r
469+ r
471470
472471 class cache f ?timer size_c =
473472 let c = create f ?timer size_c in
0 commit comments