You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 7032 Reporter: jura Status: closed (set by @alainfrisch on 2015-11-12T14:42:46Z) Resolution: not a bug Priority: normal Severity: minor Platform: x86_64GNU/Linux3.13.0-66-generic OS: Ubuntu OS Version: 14.04.3 Version: 4.02.3 Category: ~DO NOT USE (was: OCaml general) Tags: suggest_closing
Bug description
The program is:
exception Timeout
let sigalrm_handler = Sys.Signal_handle (fun _ -> raise Timeout)
let timeout f arg time default_value =
let old_behavior = Sys.signal Sys.sigalrm sigalrm_handler in
let reset_sigalrm () = Sys.set_signal Sys.sigalrm old_behavior in
ignore (Unix.alarm time);
try
let res = f arg in
reset_sigalrm ();
res
with exc ->
reset_sigalrm ();
if exc=Timeout then default_value
else raise exc
let rec loop x = loop x
let _ =
Printf.printf "Got %s\n%!" (timeout loop 0 2 "timeout");
When compiling with "ocamlc unix.cma timeout.ml" the program terminates, but when compiling with "ocamlopt unix.cmxa timeout.ml" the program does not terminate.
Steps to reproduce
Compile the program given in the description with ""ocamlc unix.cma timeout.ml" then run with "./a.out". Then "rm a.out && ocamlopt unix.cmxa timeout.ml && ./a.out" and observe the program not terminate.
Original bug ID: 7032
Reporter: jura
Status: closed (set by @alainfrisch on 2015-11-12T14:42:46Z)
Resolution: not a bug
Priority: normal
Severity: minor
Platform: x86_64GNU/Linux3.13.0-66-generic
OS: Ubuntu
OS Version: 14.04.3
Version: 4.02.3
Category: ~DO NOT USE (was: OCaml general)
Tags: suggest_closing
Bug description
The program is:
When compiling with "ocamlc unix.cma timeout.ml" the program terminates, but when compiling with "ocamlopt unix.cmxa timeout.ml" the program does not terminate.
Steps to reproduce
Compile the program given in the description with ""ocamlc unix.cma timeout.ml" then run with "./a.out". Then "rm a.out && ocamlopt unix.cmxa timeout.ml && ./a.out" and observe the program not terminate.
Additional information
Also reproduce on Mac osx 10.10
File attachments
The text was updated successfully, but these errors were encountered: