-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
$ dune exec ./trivial.exe | ||
Ok | ||
|
||
$ dune exec ./send.exe | ||
Async | ||
|
||
$ dune exec ./multithreading.exe | ||
Async | ||
|
||
$ dune exec ./exception.exe | ||
Exception | ||
Ok |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
(cram | ||
(deps | ||
trivial.exe | ||
send.exe | ||
multithreading.exe | ||
exception.exe | ||
)) | ||
|
||
(executables | ||
(names | ||
trivial | ||
send | ||
multithreading | ||
exception | ||
) | ||
(libraries luv unit_helpers) | ||
(flags -open Unit_helpers)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
let () = | ||
Luv.Async.init (fun _async -> raise Exit) | ||
|> ok "async init" @@ fun async -> | ||
|
||
Luv.Error.set_on_unhandled_exception begin function | ||
| Exit -> | ||
print_endline "Exception"; | ||
Luv.Handle.close async ignore | ||
| _ -> | ||
() | ||
end; | ||
|
||
Luv.Async.send async |> ok "send" @@ fun () -> | ||
|
||
Luv.Loop.run () |> ignore; | ||
|
||
print_endline "Ok" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
let () = | ||
Luv.Async.init begin fun async -> | ||
print_endline "Async"; | ||
Luv.Handle.close async ignore | ||
end | ||
|> ok "async init" @@ fun async -> | ||
|
||
ignore @@ Thread.create begin fun () -> | ||
Unix.sleepf 0.2; | ||
Luv.Async.send async |> ignore | ||
end (); | ||
|
||
Luv.Loop.run () |> ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
let () = | ||
Luv.Async.init begin fun async -> | ||
print_endline "Async"; | ||
Luv.Handle.close async ignore | ||
end | ||
|> ok "async init" @@ fun async -> | ||
|
||
Luv.Async.send async |> ok "send" @@ fun () -> | ||
|
||
Luv.Loop.run () |> ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
let () = | ||
Luv.Async.init ignore |> ok "init" @@ fun async -> | ||
Luv.Handle.close async ignore; | ||
print_endline "Ok" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters