Skip to content

Instantly share code, notes, and snippets.

@kayceesrk
Created August 18, 2015 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kayceesrk/21bb37b4e7cf92e7ca54 to your computer and use it in GitHub Desktop.
Save kayceesrk/21bb37b4e7cf92e7ca54 to your computer and use it in GitHub Desktop.
Trigger read fault deadlock.
let r1 : int list ref = ref [1024]
let r2 : int list ref = ref [1024]
let rec foo lr fr = function
| 0 -> foo lr fr 1024
| i ->
let v = Random.int i in
lr := [v];
foo lr fr @@ List.hd(!fr)
let () = Domain.spawn (fun () -> foo r1 r2 1024)
let () = foo r2 r1 1024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment