caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Cedric Cellier <rixed@happyleptic.org>
To: caml-list@inria.fr
Subject: Thread.delay to raise EINTR exception ?
Date: Thu, 28 Oct 2010 14:18:10 +0200	[thread overview]
Message-ID: <20101028121810.GA32597@securactive.net> (raw)

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 ?


             reply	other threads:[~2010-10-28 12:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-28 12:18 Cedric Cellier [this message]
2010-10-28 13:02 ` [Caml-list] " Paolo Donadeo
2010-10-28 14:32   ` Niki Yoshiuchi
2010-10-28 14:53 ` Cedric Cellier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101028121810.GA32597@securactive.net \
    --to=rixed@happyleptic.org \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).