* [Caml-list] signals and exceptions
@ 2002-11-30 18:32 Andy Chou
2002-12-01 15:06 ` Alan Schmitt
0 siblings, 1 reply; 2+ messages in thread
From: Andy Chou @ 2002-11-30 18:32 UTC (permalink / raw)
To: caml-list
Can I safely throw an exception inside a signal handler, for the purposes
of timeout? For example:
exception Timeout
Sys.set_signal Sys.sigalrm (Sys.Signal_handle (fun _ -> raise Timeout));
(try
ignore(Unix.alarm 5);
work();
if Unix.alarm 0 == 0 then
Unix.pause()
with Timeout -> printf "TIMEOUT\n");
Sys.set_signal Sys.sigalrm Sys.Signal_ignore;
Will there be an GC problems, etc? I've noticed that a program that uses
this idiom non-deterministically seg faults.
-Andy
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-12-01 14:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-30 18:32 [Caml-list] signals and exceptions Andy Chou
2002-12-01 15:06 ` Alan Schmitt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).