i would need a macro(?) to protect some code (file ops)
against user/keyboard's control-c. Anybody has done it (and wants to share)?
TIA
> i would need a macro(?) to protect some code (file ops)
> against user/keyboard's control-c. Anybody has done it (and wants to share)?
ok, i've found it: (with-enabled-interrupts interrupt-set . body)
But how to make up the interrupt-set, if i want to remove just one signal?
it seems, that scsh/low-interrupt.scm does not export the necessary ops on the
i-set (e.g. remove-interrupt).
or am i just missing something?
........ [experimentation: looking up the package, interface ....]
11> (interrupt-in-set? (enabled-interrupts) interrupt/int)
Error: undefined variable
interrupt-in-set?
(package user)
12> ,open low-interrupt
Newly accessible in user: (interrupt-in-set?)
12>
12> (interrupt-in-set? (enabled-interrupts)
interrupt/int)
Scheme48 heap overflow
Process scheme exited abnormally with code 255
let's restart:
Welcome to scsh 0.6.1 (Combinatorial Algorithms)
Type ,? for help.
>
> ,open low-interrupt
> (interrupt-in-set? (enabled-interrupts)
interrupt/int)
Scheme48 heap overflow
Process scheme exited abnormally with code 255
Michal> m...@maruska.dyndns.org (Michal Maruška) writes:
>> i would need a macro(?) to protect some code (file ops)
>> against user/keyboard's control-c. Anybody has done it (and wants to share)?
Michal> ok, i've found it: (with-enabled-interrupts interrupt-set . body)
Michal> But how to make up the interrupt-set, if i want to remove just one signal?
Michal> it seems, that scsh/low-interrupt.scm does not export the necessary ops on the
Michal> i-set (e.g. remove-interrupt).
Michal> or am i just missing something?
I also think that these operations should be exported. However, I
don't like the current representation of interrupt sets by "a
two's-complement representation of the bit set".
Michal> ........ [experimentation: looking up the package, interface ....]
11> (interrupt-in-set? (enabled-interrupts) interrupt/int)
Michal> Error: undefined variable
>> interrupt-in-set?
>> (package user)
12> ,open low-interrupt
Michal> Newly accessible in user: (interrupt-in-set?)
12>
12> (interrupt-in-set? (enabled-interrupts)
Michal> interrupt/int)
Michal> Scheme48 heap overflow
Michal> Process scheme exited abnormally with code 255
Michal> let's restart:
Michal> Welcome to scsh 0.6.1 (Combinatorial Algorithms)
Michal> Type ,? for help.
>>
>> ,open low-interrupt
>> (interrupt-in-set? (enabled-interrupts)
Michal> interrupt/int)
Michal> Scheme48 heap overflow
Michal> Process scheme exited abnormally with code 255
This is not a bug, you just confused the order of the
arguments. (enabled-interrupts) as a interrupt number and thereby an
index in a bit set is just too large for a 32 bit machine ;-)
--
Martin
> >>>>> "Michal" == Michal Maru¹ka <m...@maruska.dyndns.org> writes:
> >> (interrupt-in-set? (enabled-interrupts)
> Michal> interrupt/int)
> Michal> Scheme48 heap overflow
> This is not a bug, you just confused the order of the arguments.
I keep confusing order, but i consider heap overflow
in scheme VM a bug.
today i happened to this:
(error 'diff diff)
skips to the handler:
(lambda (c next)
(logformat "exception: ~s ~s-> escaping the loop\n"
c (nth 1 c))
(cont #f))
i was getting another heap overflow, just to discover NTH's proper arguments.
s48 seems fragile to me.
am i wrong ?
Michal> Martin Gasbichler <gasb...@informatik.uni-tuebingen.de> writes:
>> >>>>> "Michal" == Michal Maruška <m...@maruska.dyndns.org> writes:
>> >> (interrupt-in-set? (enabled-interrupts)
Michal> interrupt/int)
Michal> Scheme48 heap overflow
>> This is not a bug, you just confused the order of the arguments.
Michal> I keep confusing order, but i consider heap overflow
Michal> in scheme VM a bug.
Michal> today i happened to this:
Michal> (error 'diff diff)
Michal> skips to the handler:
Michal> (lambda (c next)
Michal> (logformat "exception: ~s ~s-> escaping the loop\n"
Michal> c (nth 1 c))
Michal> (cont #f))
Michal> i was getting another heap overflow, just to discover NTH's proper arguments.
Michal> s48 seems fragile to me.
I'm not sure I see exactly what you're doing, but I wonder how any
language implementation should handle infinite non-tail-recursion more
robustly. What's a stack overflow in other language implementations
is a heap overflow in Scheme 48, so no big difference there. The
alternative is growing the heap until it takes up all virtual memory.
This I would consider much more fragile.
We're actually thinking about detecting infinite non-tail recursion in
the context of a new memory management system for Scheme 48, but it's
not a trivial issue, and not one many others address.
PS: You did notice NTH is deprecated in favor of LIST-REF, right?
--
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla
after reading your mail several times (and thinkink about NTH implementation,
and what it has to do w/ infinite recursion...)
I now realize it:
my code, in the exception handler, raises another exception.
Thanks, my code is/was fragile.
nn
The fact is, that i want to handle only my "(error" or whatever is the right mean
to signal exceptions, and i still don't know the exception/condition/.. system.
The multiple versions of definitions in scheme/ subdir definitely confuse me (if
i'm to learn it just by grepping and reading the code).
BTW: is there a way, how scsh can detect, that a subprocess core-dumped?
Michal> after reading your mail several times (and thinkink about NTH implementation,
Michal> and what it has to do w/ infinite recursion...)
Michal> I now realize it:
Michal> my code, in the exception handler, raises another exception.
Michal> Thanks, my code is/was fragile.
Well, in fact, the exception system is rather fragile in this regard,
it's not really your fault. We're working on a replacement, but we
need a proper design first.
Michal> nn
Michal> The fact is, that i want to handle only my "(error" or whatever is the right mean
Michal> to signal exceptions, and i still don't know the exception/condition/.. system.
Michal> The multiple versions of definitions in scheme/ subdir definitely confuse me (if
Michal> i'm to learn it just by grepping and reading the code).
Exactly what multiple versions confuse you?
Michal> BTW: is there a way, how scsh can detect, that a subprocess core-dumped?
You can examine the signal that killed your child via (status:term-sig
status), but I don't know a way to detect the creation of a core file
in Unix.
--
Martin