Hi,
I've noticed some strange behavior of PolyML 4.2.0 for i386/Linux with respect
to signals and signal handlers.
Basically, what happens is that after installing my own signal handler for (in
my case) the ALRM signal, committing the database, and restarting PolyML,
further signals are apparently not delivered anymore, even though the handler
itself is installed properly.
Can anyone confirm this behavior, or even better yet, does anyone have an
explanation? Maybe I'm just overlooking the obvious.
Below is a minimal example, with relevant output included.
Best regards,
Tjark
,-----
$./poly
Poly/ML RTS version I386-4.1.3 (13:57:33 Sep 30 2002)
Copyright (c) 2002 CUTS and contributors.
Running with heap parameters (h=10240K,ib=2048K,ip=100%,mb=6144K,mp=20%)
Mapping ./ML_dbase
Poly/ML 4.1.3 Release
> val flag = ref false;
val flag = ref false : bool ref
> Signal.signal (Posix.Signal.alrm, Signal.SIG_HANDLE (fn _ => flag := true));
val it = SIG_DFL : Signal.sig_handle
> Posix.Process.alarm (Time.fromSeconds 0);
val it = 0.000 : Time.time
> !flag;
val it = true : bool
> PolyML.commit();
[...]
Mapping ./ML_dbase
val it = true : bool
> PolyML.quit();
$ ./poly
Poly/ML RTS version I386-4.1.3 (13:57:33 Sep 30 2002)
Copyright (c) 2002 CUTS and contributors.
Running with heap parameters (h=10240K,ib=2048K,ip=100%,mb=6144K,mp=20%)
Mapping ./ML_dbase
Poly/ML 4.1.3 Release
> flag := false;
val it = () : unit
> Posix.Process.alarm (Time.fromSeconds 0);
val it = 0.000 : Time.time
> !flag;
val it = false : bool
So the handler appears not to be called. It is however installed properly:
> val (Signal.SIG_HANDLE handler) = Signal.signal (Posix.Signal.alrm,
Signal.SIG_DFL);
val handler = fn : int -> unit
> handler 14;
val it = () : unit
> !flag;
val it = true : bool
`-----