chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] disable-interrupts


From: Felix Winkelmann
Subject: Re: [Chicken-users] disable-interrupts
Date: Wed, 15 Jan 2003 09:40:04 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.0) Gecko/20020530

Joerg F. Wittenberger wrote:
Hi all,

can anybody help me with the meaning of "disable-interrupts"?  As I
understand the generated code will not check for interrrupts during
the execution.  Therefore there will be no thread context change
except explicitely via thread-yield! .  (Is this correct?)

Right.


If I'm correct, this option desirable for code, which is short and
often used.  Best if the code has a constant execution time.  I do
have a few lines, which I'd like to compile that way.  But in the very
same module I'd like to have code, which will run for too long to
ignore interrupts and other threads.  Can I mix options for code
sections, or will I have to reorganize my whole module structure?


You can use the `disable-interrupts' and `enable-interrupts'
procedures. Or use the `critical-section' macro:

; interrupts are enabled...

(critical-section
  ; interrupts are disabled
  ...
  )

; enabled again...

`critical-section' expands into something like:

(dynamic-wind
  disable-interrupts
  (lambda () ...)
  enable-interrupts)


cheers,
felix





reply via email to

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