unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* primitive _exit
@ 2006-04-27  1:33 Kevin Ryde
  2006-04-27  7:31 ` Neil Jerram
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Ryde @ 2006-04-27  1:33 UTC (permalink / raw)


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.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: primitive _exit
  2006-04-27  1:33 primitive _exit Kevin Ryde
@ 2006-04-27  7:31 ` Neil Jerram
  2006-05-15  0:33   ` Kevin Ryde
  0 siblings, 1 reply; 5+ messages in thread
From: Neil Jerram @ 2006-04-27  7:31 UTC (permalink / raw)


Kevin Ryde <user42@zip.com.au> writes:

> 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.

How about primitive-_exit ?  It's a little odd, but I think will be
intuitive to anyone looking for _exit.  I know we don't conventionally
use underscores in Scheme, but I don't think doing so will break
anything.

The doc is great.

    Neil



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: primitive _exit
  2006-04-27  7:31 ` Neil Jerram
@ 2006-05-15  0:33   ` Kevin Ryde
  2006-05-19  7:17     ` Neil Jerram
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Ryde @ 2006-05-15  0:33 UTC (permalink / raw)
  Cc: guile-devel

Neil Jerram <neil@ossau.uklinux.net> writes:
>
> How about primitive-_exit ?  It's a little odd, but I think will be
> intuitive to anyone looking for _exit.

Yep, beaut.  I put it in under that name.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: primitive _exit
  2006-05-15  0:33   ` Kevin Ryde
@ 2006-05-19  7:17     ` Neil Jerram
  2006-05-19 23:12       ` Kevin Ryde
  0 siblings, 1 reply; 5+ messages in thread
From: Neil Jerram @ 2006-05-19  7:17 UTC (permalink / raw)
  Cc: guile-devel

Kevin Ryde <user42@zip.com.au> writes:

> Neil Jerram <neil@ossau.uklinux.net> writes:
>>
>> How about primitive-_exit ?  It's a little odd, but I think will be
>> intuitive to anyone looking for _exit.
>
> Yep, beaut.  I put it in under that name.

I'm afraid I'm now seeing an error building CVS 1.8 branch:

simpos.c:220: warning: no previous prototype for `chart_primitive__exit'

Also, what is the meaning of the "chart" prefix?  I couldn't work it
out.

Regards,
        Neil



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: primitive _exit
  2006-05-19  7:17     ` Neil Jerram
@ 2006-05-19 23:12       ` Kevin Ryde
  0 siblings, 0 replies; 5+ messages in thread
From: Kevin Ryde @ 2006-05-19 23:12 UTC (permalink / raw)
  Cc: guile-devel

Neil Jerram <neil@ossau.uklinux.net> writes:
>
> simpos.c:220: warning: no previous prototype for `chart_primitive__exit'

Yes, oops, I didn't see that because I don't believe in -Werror.

> Also, what is the meaning of the "chart" prefix?  I couldn't work it
> out.

Too much cut and paste.  Cough. :-)


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-05-19 23:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-27  1:33 primitive _exit Kevin Ryde
2006-04-27  7:31 ` Neil Jerram
2006-05-15  0:33   ` Kevin Ryde
2006-05-19  7:17     ` Neil Jerram
2006-05-19 23:12       ` Kevin Ryde

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 read-only IMAP folder(s) and NNTP newsgroup(s).