guile-user
[Top][All Lists]
Advanced

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

flushing output ports upon Guile termination (and scm_i_terminating)


From: Marco Maggi
Subject: flushing output ports upon Guile termination (and scm_i_terminating)
Date: Fri, 31 Mar 2006 07:32:10 +0200

Ciao,

  I see that: if an output port is not GC'ed before the
termination of the Guile process, its flush function is
invoked ('libguile/init.c', 'really_cleanup_for_exit()';
'cleanup_for_exit()' registered as 'atexit()' handler).

  This is causing me troubles because I have an output
port whose flush function:

* has to raise an error if the "underlying device"
  cannot be accessed; but,

* it must not raise an error if this happens upon
  termination of Guile, because at this time it is
  normal for the device not to be there anymore.

  My "underlying device" is another C object.

  I see that in version 1.6.7 of Guile there is a
global variable called 'scm_i_terminating' that is set
to 1 before the invocation of 'scm_flush_all_ports()';
so flush functions (example: 'fport_flush()',
'libguile/fports.c') can test it and choose what to do
in case of error.

  I'm using Guile version 1.8.0: here 'scm_i_terminating'
is not set to 1 before invoking 'scm_flush_all_ports()',
but 'fport_flush()' still tests it.

  In both versions I do not see where 'scm_i_terminating'
is initialised to zero, but when it comes to my functions
it is set to zero (my ignorance on C?), even when the
process is terminating.

  Conclusion: how can I test, in my flush function, if
the process is exiting?

Thank you for your time.

--
Marco Maggi

"They say jump!, you say how high?"
Rage Against the Machine - "Bullet in the Head"






reply via email to

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