Last active
December 14, 2015 02:19
-
-
Save yoshihiro503/5012456 to your computer and use it in GitHub Desktop.
ocaml-4.00.1 および ocaml-3.12.1で確認。バイトコードでもネイティブでも起きる。 -vmthreadだと起きない $ ocamlc -thread unix.cma threads.cma mumumus.ml
This file contains hidden or 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
(* | |
(*なぜかこの関数定義があると下記でSIGALRMが呼ばれなくなる *) | |
let hogehoge f x = Thread.create f x | |
*) | |
let wait () = | |
let m = Mutex.create () in | |
Mutex.lock m; | |
let c = Condition.create () in | |
Condition.wait c m | |
let _ = | |
Sys.set_signal Sys.sigalrm (Sys.Signal_handle | |
(fun n -> print_endline "HOGE")); | |
ignore (Unix.alarm 1); | |
wait () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment