* Thread.delay to raise EINTR exception ? @ 2010-10-28 12:18 Cedric Cellier 2010-10-28 13:02 ` [Caml-list] " Paolo Donadeo 2010-10-28 14:53 ` Cedric Cellier 0 siblings, 2 replies; 4+ messages in thread From: Cedric Cellier @ 2010-10-28 12:18 UTC (permalink / raw) To: caml-list Hello list ! I'm using Thread.delay on a unix platform, and sometimes it seams that the thread that called Thread.delay is killed because it did not catch the exception that seams to be raised from the delay : Thread 1 killed on uncaught exception Unix.Unix_error(11, "select", "") Raised at file "thread.ml", line 60, characters 23-50 This happens frequently when I run the program with gprof (since gprof uses an alarm signal apparently). Here is the relevant section of strace, showing the delay as a select with timeout and the gprof signal : 32506 select(0, [], [], [], {0, 2153}) = 0 (Timeout) 32506 select(0, [], [], [], {0, 2647}) = 0 (Timeout) 32506 select(0, [], [], [], {0, 2030}) = ? ERESTARTNOHAND (To be restarted) 32506 --- SIGPROF (Profiling timer expired) @ 0 (0) --- 32506 rt_sigreturn(0x1b) = -1 EINTR (Interrupted system call) 32506 write(2, "Thread 1 killed on uncaught exce"..., 72) = 72 32506 write(2, "Raised at file \"thread.ml\", line"..., 54) = 54 The problem I have with this, is that in my opinion this is not a correct behavior for the Thread.delay function : This underlying select should handle EINTR internaly, and it seams wrong to me to have to "try" Thread.delay in my program. What do you think ? Should I fill a bug ? ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] Thread.delay to raise EINTR exception ? 2010-10-28 12:18 Thread.delay to raise EINTR exception ? Cedric Cellier @ 2010-10-28 13:02 ` Paolo Donadeo 2010-10-28 14:32 ` Niki Yoshiuchi 2010-10-28 14:53 ` Cedric Cellier 1 sibling, 1 reply; 4+ messages in thread From: Paolo Donadeo @ 2010-10-28 13:02 UTC (permalink / raw) To: OCaml mailing list It's a known pitfall. Read this discussion of some months ago: http://caml.inria.fr/pub/ml-archives/caml-list/2010/08/242cee79bb97e86bc93bc6bd88d2f256.en.html -- Paolo ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] Thread.delay to raise EINTR exception ? 2010-10-28 13:02 ` [Caml-list] " Paolo Donadeo @ 2010-10-28 14:32 ` Niki Yoshiuchi 0 siblings, 0 replies; 4+ messages in thread From: Niki Yoshiuchi @ 2010-10-28 14:32 UTC (permalink / raw) To: OCaml mailing list [-- Attachment #1: Type: text/plain, Size: 856 bytes --] This is mentioned in "Unix system programming in Object Caml"* in section 4.5. The solution given in the book is wrap the function call in a try...with. It doesn't feel right to me either, but I don't know if there is a better alternative. *http://ocamlunix.forge.ocamlcore.org/ On Thu, Oct 28, 2010 at 9:02 AM, Paolo Donadeo <p.donadeo@gmail.com> wrote: > It's a known pitfall. Read this discussion of some months ago: > > > http://caml.inria.fr/pub/ml-archives/caml-list/2010/08/242cee79bb97e86bc93bc6bd88d2f256.en.html > > > -- > Paolo > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > [-- Attachment #2: Type: text/html, Size: 1725 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] Thread.delay to raise EINTR exception ? 2010-10-28 12:18 Thread.delay to raise EINTR exception ? Cedric Cellier 2010-10-28 13:02 ` [Caml-list] " Paolo Donadeo @ 2010-10-28 14:53 ` Cedric Cellier 1 sibling, 0 replies; 4+ messages in thread From: Cedric Cellier @ 2010-10-28 14:53 UTC (permalink / raw) To: caml-list Thank you very much for all your answers. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-10-28 14:53 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-10-28 12:18 Thread.delay to raise EINTR exception ? Cedric Cellier 2010-10-28 13:02 ` [Caml-list] " Paolo Donadeo 2010-10-28 14:32 ` Niki Yoshiuchi 2010-10-28 14:53 ` Cedric Cellier
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox