Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

C-c transactions

0 views
Skip to first unread message

Michal Maruška

unread,
Mar 19, 2002, 10:33:07 AM3/19/02
to

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

Michal Maruška

unread,
Mar 20, 2002, 7:25:08 PM3/20/02
to

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)?

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

Martin Gasbichler

unread,
Mar 22, 2002, 3:40:26 AM3/22/02
to

>>>>> "Michal" == Michal Maruška <m...@maruska.dyndns.org> writes:

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 Maruška

unread,
Apr 13, 2002, 9:40:56 AM4/13/02
to

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.

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 ?

Michael Sperber [Mr. Preprocessor]

unread,
Apr 13, 2002, 10:52:02 AM4/13/02
to

>>>>> "Michal" == Michal Maruška <m...@maruska.dyndns.org> writes:

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

Michal Maruška

unread,
Apr 13, 2002, 11:26:03 AM4/13/02
to

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?

Michael Sperber [Mr. Preprocessor]

unread,
Apr 13, 2002, 1:48:02 PM4/13/02
to

>>>>> "Michal" == Michal Maruška <m...@maruska.dyndns.org> writes:

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?

Martin Gasbichler

unread,
Apr 14, 2002, 1:47:14 PM4/14/02
to

>>>>> "Michal" == Michal Maruška <m...@maruska.dyndns.org> writes:


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

0 new messages