Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update example 4 to use receive_any #96

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/4-long-lived-processes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ someone, and continues awaiting.

```ocaml
let rec loop () =
(match receive () with
(match receive_any () with
| Hello name -> print_endline ("Hello, " ^ name ^ "! :D")
| _ -> print_endline "Oh no, an unhandled message! D:");
loop ()
Expand All @@ -37,7 +37,7 @@ One caveat is that because function application can't be interrupted, we need
to make sure we _yield_ control back to the scheduler at some point before
recursing. Otherwise one of the cores will be _blocked_ by this process until it yields.

In our example, this is done automatically when we call `receive`
In our example, this is done automatically when we call `receive_any`

In fact, we are strategically placing yields all through the standard library
to make it as seamless as possible to write Riot programs without thinking
Expand Down