File tree 1 file changed +9
-8
lines changed
1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -576,15 +576,16 @@ let test_timeout () =
576
576
Domain_local_timeout. set_system (module Thread ) (module Unix );
577
577
578
578
let check (op : ?timeoutf:float -> bool Loc.t -> unit ) () =
579
- let x = Loc. make false in
580
- let finally =
581
- Domain_local_timeout. set_timeoutf 0.3 @@ fun () -> Loc. set x true
579
+ let rec loop n =
580
+ let x = Loc. make false in
581
+ let (_ : unit -> unit ) =
582
+ Domain_local_timeout. set_timeoutf 0.3 @@ fun () -> Loc. set x true
583
+ in
584
+ match op ~timeoutf: 0.01 x with
585
+ | () -> if 0 < n then loop (n - 1 ) else assert false
586
+ | exception Timeout. Timeout -> op ~timeoutf: 1.0 x
582
587
in
583
- Fun. protect ~finally @@ fun () ->
584
- (match op ~timeoutf: 0.01 x with
585
- | () -> assert false
586
- | exception Timeout. Timeout -> () );
587
- op ~timeoutf: 1.0 x
588
+ loop 5
588
589
in
589
590
run_domains
590
591
[
You can’t perform that action at this time.
0 commit comments