From: oliver <oliver@first.in-berlin.de>
To: Jeremie Dimino <jdimino@janestreet.com>
Cc: caml-list@inria.fr, ocsigen@inria.fr
Subject: Re: [Caml-list] BUG in unix.ml (was: strange errors when linking lwt.unix)
Date: Fri, 15 Mar 2013 16:11:34 +0100 [thread overview]
Message-ID: <20130315151134.GA5194@siouxsie> (raw)
In-Reply-To: <CANhEzE48OVPjkbOsNoM9WCwY6z2evHvg1qJiufsCff_KZ5F72Q@mail.gmail.com>
On Fri, Mar 15, 2013 at 03:05:51PM +0000, Jeremie Dimino wrote:
> On Fri, Mar 15, 2013 at 2:27 PM, oliver <oliver@first.in-berlin.de> wrote:
> > Just by your activation of signal function
> > - not blocking, but handling "Sys.Signal_handle" but with the unreliable signal semantics
> > this has cause the problems.
> >
> > signal(2) opened the pandoras box.
>
> Actually OCaml is using sigaction(2). It is only using signal(2) when
> sigaction is not available.
>
> Actually there are two different things here:
>
> - signal disposition: this is a process-wide settings for each signal
> describing how to react when it is received. It can be changed with
> the [sigaction] system call (or the less portable [signal]).
> - signal mask: it is a per-thread set of signals that are blocked. It
> can be changed with sigprocmask.
>
> When a signal is received by a thread, if it is blocked it will be
> pending until it is unblocked. When it is not blocked and the
> threaded is waiting on an interruptible system call and the
> disposition of the signal is a user-defined handler, the system call
> will fail with EINTR and the handler will be invoked.
>
> So basically Sys.set_signal and Unix.sigprocmask are two different
> things. You should block signals when you are running some code that
> you don't want to be interrupted:
>
> # #load "unix.cma";;
> # Sys.set_signal Sys.sigusr1 (Sys.Signal_handle (fun _ ->
> print_endline "signal!"));;
> - : unit = ()
> # let old_mask = Unix.sigprocmask Unix.SIG_BLOCK [Sys.sigusr1];;
> val old_mask : int list = []
> # Unix.kill (Unix.getpid ()) Sys.sigusr1;;
> - : unit = ()
> # Unix.sigprocmask Unix.SIG_SETMASK old_mask;;
> signal!
> - : int list = [-12]
>
> The man page describing all this is signal(7).
[...]
I don't know why you are telling me this.
i did not asked about it.
But if you wish to explain it to yourself, go on.
Ciao,
Oliver
next prev parent reply other threads:[~2013-03-15 15:11 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAMu2m2Lt8oty_2mEQq8H1oV0-1Rjrf10ai543me9YxB1Nb5xfg@mail.gmail.com>
[not found] ` <CALScVY=c1M=HAqMeM7x4QrxDTZsn0rB=HcTsQYheYUOBSBFRUQ@mail.gmail.com>
[not found] ` <CALScVYnt-m-dRR41rBPo5R3xDx-81tMwBFbM3q+5p4gRqsQC9w@mail.gmail.com>
[not found] ` <CALScVYmU7zEXbgdS21gGrq8iFvgVs0FWieKipRE9WtOM+PxeEg@mail.gmail.com>
2013-03-15 9:18 ` Florian Hars
2013-03-15 10:02 ` oliver
2013-03-15 10:11 ` David House
2013-03-15 11:38 ` Jeremie Dimino
2013-03-15 12:43 ` oliver
2013-03-15 13:17 ` Jeremie Dimino
2013-03-15 13:28 ` oliver
2013-03-15 13:43 ` Jeremie Dimino
2013-03-15 13:24 ` Jeremie Dimino
2013-03-15 13:58 ` oliver
2013-03-15 14:05 ` oliver
2013-03-15 14:16 ` Jeremie Dimino
2013-03-15 14:18 ` oliver
2013-03-15 14:17 ` oliver
2013-03-15 14:27 ` oliver
2013-03-15 15:05 ` Jeremie Dimino
2013-03-15 15:11 ` oliver [this message]
2013-03-15 15:44 ` Gabriel Kerneis
2013-03-15 16:00 ` oliver
2013-03-15 16:12 ` Gabriel Kerneis
2013-03-15 16:25 ` oliver
2013-03-15 17:28 ` Jeremie Dimino
2013-03-15 15:16 ` oliver
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=20130315151134.GA5194@siouxsie \
--to=oliver@first.in-berlin.de \
--cc=caml-list@inria.fr \
--cc=jdimino@janestreet.com \
--cc=ocsigen@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