src/Pure/ML-Systems/smlnj.ML
changeset 28488 18fea7e88ea1
parent 28443 de653f1ad78b
child 29564 f8b933a62151
     1.1 --- a/src/Pure/ML-Systems/smlnj.ML	Fri Oct 03 20:10:44 2008 +0200
     1.2 +++ b/src/Pure/ML-Systems/smlnj.ML	Fri Oct 03 21:06:36 2008 +0200
     1.3 @@ -187,45 +187,6 @@
     1.4  end;
     1.5  
     1.6  
     1.7 -(** Signal handling: emulation of the Poly/ML Signal structure. Note that types
     1.8 -    Posix.Signal.signal and Signals.signal differ **)
     1.9 -
    1.10 -structure IsaSignal =
    1.11 -struct
    1.12 -
    1.13 -datatype sig_handle = SIG_DFL | SIG_IGN | SIG_HANDLE of Signals.signal -> unit;
    1.14 -
    1.15 -(*From the SML/NJ documentation: "HANDLER(f) installs a handler for a
    1.16 -  signal. When signal is delivered to the process, the execution state
    1.17 -  of the current thread will be bundled up as a continuation k, then
    1.18 -  f(signal,n,k) will be called. The number n is the number of times
    1.19 -  signal has been signalled since the last time f was invoked for it."*)
    1.20 -
    1.21 -fun toAction SIG_DFL = Signals.DEFAULT
    1.22 -  | toAction SIG_IGN = Signals.IGNORE
    1.23 -  | toAction (SIG_HANDLE iu) =
    1.24 -      Signals.HANDLER (fn (signo,_,cont) => (iu signo; cont));
    1.25 -
    1.26 -(*The types are correct, but I'm not sure about the semantics!*)
    1.27 -fun fromAction Signals.DEFAULT = SIG_DFL
    1.28 -  | fromAction Signals.IGNORE = SIG_IGN
    1.29 -  | fromAction (Signals.HANDLER f) =
    1.30 -      SIG_HANDLE (fn signo => SMLofNJ.Cont.callcc (fn k => (f (signo,0,k); ())));
    1.31 -
    1.32 -(*Poly/ML version has type  int * sig_handle -> sig_handle*)
    1.33 -fun signal (signo, sh) = fromAction (Signals.setHandler (signo, toAction sh));
    1.34 -
    1.35 -val usr1 = UnixSignals.sigUSR1
    1.36 -val usr2 = UnixSignals.sigUSR2
    1.37 -val alrm = UnixSignals.sigALRM
    1.38 -val chld = UnixSignals.sigCHLD
    1.39 -val cont = UnixSignals.sigCONT
    1.40 -val int = UnixSignals.sigINT
    1.41 -val quit = UnixSignals.sigQUIT
    1.42 -val term = UnixSignals.sigTERM
    1.43 -
    1.44 -end;
    1.45 -
    1.46  
    1.47  (** OS related **)
    1.48  
    1.49 @@ -241,8 +202,8 @@
    1.50  
    1.51  
    1.52  (*Convert a process ID to a decimal string (chiefly for tracing)*)
    1.53 -fun string_of_pid pid =
    1.54 -  Word.fmt StringCvt.DEC (Word.fromLargeWord (Posix.Process.pidToWord pid));
    1.55 +fun process_id pid =
    1.56 +  Word.fmt StringCvt.DEC (Word.fromLargeWord (Posix.Process.pidToWord (Posix.ProcEnv.getpid ())));
    1.57  
    1.58  
    1.59  (* getenv *)