This repository was archived by the owner on Jun 26, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 11(executable
22 (name test)
33 (preprocess (pps ppx_let))
4- (libraries alcotest alcotest-async thread_pool_async core async_kernel async_unix ))
4+ (libraries alcotest alcotest-async thread_pool_async core async_kernel))
55
66(alias
77 (name runtest)
Original file line number Diff line number Diff line change 11open Core
22open Async_kernel
3- open Async_unix
43
54module Thread_pool = Thread_pool_async
65
@@ -16,8 +15,8 @@ let test_simple () =
1615 let create () = Int. incr states in
1716 let destroy () = Int. decr states in
1817 let worker () =
19- let % bind () = after ( Time.Span. of_ms 5. ) in
20- return @@ `Ok (Int. incr jobs)
18+ ignore @@ Unix. nanosleep 0.005 ;
19+ `Ok (Int. incr jobs)
2120 in
2221
2322 let % bind pool = Thread_pool. init ~name: " unittest" ~threads ~create ~destroy in
@@ -46,8 +45,8 @@ let test_error () =
4645 Int. incr errors;
4746 failwith " Stop"
4847 | _ ->
49- let % bind () = after ( Time.Span. of_ms 5. ) in
50- return @@ `Ok (Int. incr jobs)
48+ ignore @@ Unix. nanosleep 0.005 ;
49+ `Ok (Int. incr jobs)
5150 in
5251
5352 let % bind pool = Thread_pool. init ~name: " unittest" ~threads ~create ~destroy: ignore in
@@ -73,7 +72,7 @@ let test_retry () =
7372 | false -> `Ok (Int. incr work_done)
7473 in
7574 should_fail := false ;
76- return result
75+ result
7776 in
7877 let % bind pool = Thread_pool. init ~name: " unittest" ~threads ~create ~destroy in
7978 let % bind _result = List. init work_expected ~f: ignore |> Deferred.Or_error.List. iter ~how: `Parallel ~f: (fun () -> Thread_pool. with ' ~retries: 1 pool (worker (ref true ))) in
@@ -92,7 +91,7 @@ let test_retry_fail () =
9291 let destroy = ignore in
9392 let worker () =
9493 Int. incr tries;
95- return `Attempt_retry
94+ `Attempt_retry
9695 in
9796 let % bind pool = Thread_pool. init ~name: " unittest" ~threads ~create ~destroy in
9897 let % bind result = List. init work ~f: ignore |> Deferred.Or_error.List. iter ~how: `Parallel ~f: (fun () -> Thread_pool. with ' ~retries: 0 pool worker) in
You can’t perform that action at this time.
0 commit comments