(************************************************************ sig_and_sleep.ml Created : Thu Dec 11 12:50:21 2003 Last modified: Thu Dec 11 13:03:17 2003 Compile: ocamlc -dtypes -thread unix.cma threads.cma sig_and_sleep.ml -o sig_and_sleep # FTP Directory: sources/ocaml # ************************************************************) (** @author Takashi Masuyama Xmamewo|12:59|~/test> ocamlc -dtypes -thread unix.cma threads.cma sig_and_sleep.ml -o sig_and_sleep Xmamewo|12:59|~/test> ./sig_and_sleep 15115 ---------------- Xmamewo|13:00|~> kill -USR1 15115 ---------------- signal Interrupted system call Xmamewo|DING!|~/test> *) let _ = try print_endline (string_of_int (Unix.getpid ())); Sys.set_signal Sys.sigusr1 (Sys.Signal_handle(fun e -> print_endline "signal")); Thread.delay 100.0; print_endline "wakeup!!" with Unix.Unix_error (msg, f, s) -> print_endline (Unix.error_message msg)