{"action":"opened","issue":{"url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/issues/7","labels_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/issues/7/comments","events_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/issues/7/events","html_url":"https://github.com/ocamllabs/ocaml-multicore/issues/7","id":83076904,"number":7,"title":"Unhandled raised when two domains use single function","user":{"login":"radekm","id":518912,"avatar_url":"https://avatars.githubusercontent.com/u/518912?v=3","gravatar_id":"","url":"https://api.github.com/users/radekm","html_url":"https://github.com/radekm","followers_url":"https://api.github.com/users/radekm/followers","following_url":"https://api.github.com/users/radekm/following{/other_user}","gists_url":"https://api.github.com/users/radekm/gists{/gist_id}","starred_url":"https://api.github.com/users/radekm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radekm/subscriptions","organizations_url":"https://api.github.com/users/radekm/orgs","repos_url":"https://api.github.com/users/radekm/repos","events_url":"https://api.github.com/users/radekm/events{/privacy}","received_events_url":"https://api.github.com/users/radekm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-31T12:17:37Z","updated_at":"2015-05-31T12:17:37Z","closed_at":null,"body":"The following code works as expected\r\n\r\n```ocaml\r\neffect Print : string -> unit\r\n\r\nlet run thunk =\r\n  match thunk () with\r\n  | () -> ()\r\n  | effect (Print s) k -> print_endline s; flush stdout; continue k ()\r\n\r\nlet thunk () =\r\n  let rec write x =\r\n    Printf.printf \"domain %d %s\\n\" (Domain.self ()) x;\r\n    flush stdout;\r\n    perform (Print x);\r\n    Unix.sleep 1;\r\n    write x in\r\n\r\n  (* Same as [write]. *)\r\n  let rec write2 x =\r\n    Printf.printf \"domain %d %s\\n\" (Domain.self ()) x;\r\n    flush stdout;\r\n    perform (Print x);\r\n    Unix.sleep 1;\r\n    write2 x in\r\n\r\n  Domain.spawn (fun () -> run (fun () -> write \"first\"));\r\n  write2 \"second\"\r\n\r\nlet () = run thunk\r\n```\r\n\r\nbut when I remove `write2` and replace `write2 \"second\"` by `write \"second\"` then the exception `Unhandled` is raised when performing effect `Print \"second\"`."}}