File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -1063,6 +1063,36 @@ let lwt_preemptive_tests = [
10631063 Lwt_preemptive. detach f () >> = fun x ->
10641064 Lwt. return (x = 42 )
10651065 end;
1066+ test " run_in_main_no_wait" begin fun () ->
1067+ let p, r = Lwt. wait () in
1068+ let f () =
1069+ Lwt_preemptive. run_in_main_no_wait (fun () ->
1070+ Lwt. pause () >> = fun () ->
1071+ Lwt. pause () >> = fun () ->
1072+ Lwt. wakeup r 42 ;
1073+ Lwt. return () )
1074+ in
1075+ Lwt_preemptive. detach f () >> = fun () ->
1076+ p >> = fun x ->
1077+ Lwt. return (x = 42 )
1078+ end;
1079+ test " run_in_main_with_dont_wait" begin fun () ->
1080+ let p, r = Lwt. wait () in
1081+ let f () =
1082+ Lwt_preemptive. run_in_main (fun () ->
1083+ Lwt. dont_wait
1084+ (fun () ->
1085+ Lwt. pause () >> = fun () ->
1086+ Lwt. pause () >> = fun () ->
1087+ Lwt. wakeup r 42 ;
1088+ Lwt. return () )
1089+ (function _ -> Stdlib. exit 2 );
1090+ Lwt. return () )
1091+ in
1092+ Lwt_preemptive. detach f () >> = fun () ->
1093+ p >> = fun x ->
1094+ Lwt. return (x = 42 )
1095+ end;
10661096]
10671097
10681098let getlogin_works =
You can’t perform that action at this time.
0 commit comments