guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

primitive _exit


From: Kevin Ryde
Subject: primitive _exit
Date: Thu, 27 Apr 2006 11:33:35 +1000
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

The subject of _exit() as opposed to exit() has come up before.  I
propose to add _exit as a `primitive-primitive-exit', so you can
really get out of a process straight away, with no C or Scheme level
stuff.  The docs would be per below, adding the existing but
undocumented plain `exit' too.

Not sure about the name primitive-primitive-exit.  It's pretty ugly,
but something shorter like `_exit' would make the heirarchy of exits a
lot less obvious.

Also not sure what should be said about threads for the scheme `exit'.
The way it throws `quit' means it goes to the thread error handler.
Dunno if it should do something special to try to unwind all threads,
or if it should only exit the current thread, or what.


 -- Scheme Procedure: exit [status]
 -- Scheme Procedure: primitive-exit [status]
 -- Scheme Procedure: primitive-primitive-exit [status]
 -- C Function: scm_primitive_exit (status)
 -- C Function: scm_primitive_primitive_exit (status)
     Terminate the current process.  The three functions differ in what
     cleanups are done before actual termination.  STATUS is the exit
     code, an integer between 0 and 255 (*note Exit Status: (libc)Exit
     Status.).  The default STATUS is 0, which means a normal
     successful exit.

     `exit' is the usual way to terminate a Guile process, it unwinds
     the Scheme stack (*note Dynamic Wind::), forces output of data on
     ports (per *note `flush-all-ports': Writing.), then exits with the
     usual C-level `exit'.

     `primitive-exit' is just the C `exit' function (*note Normal
     Termination: (libc)Normal Termination.).  Calling this means
     Scheme-level cleanups are not run.

     `primitive-primitive-exit' is the `_exit' system call (*note
     Termination Internals: (libc)Termination Internals.).  Calling
     this terminates the program immediately, with neither Scheme-level
     nor C-level cleanups done.

     The typical use for `primitive-primitive-exit' is from a child
     process created with `primitive-fork'.  For example in a Gdk
     program the child inherits the X server connection and a C-level
     `atexit' cleanup which will close that connection, but closing in
     the child will upset the protocol in the parent, so
     `primitive-primitive-exit' would be used to avoid that.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]