Nested InterruptLock Unlock

Hi all,

Is following possible?

InterruptLock( &a );

InterruptLock( &b );

InterruptUnlock( &b);

InterruptUnlock( &a);


Does the first InterruptUnlock() reenable the irq’s?

-Michael

Michael, the argument of InterruptLock/Unlock is a spinlock,
not an irq.
The InterruptLock is used to acquire an spinlock (used between
threads and isr-handler. A kind of mutex but available in a
thread AND in an irq.
InterruptLock/Unlock has nothing to do with irq enable/disable.
cheers, peter



Michael Tasche wrote:

Hi all,

Is following possible?

InterruptLock( &a );

InterruptLock( &b );

InterruptUnlock( &b);

InterruptUnlock( &a);


Does the first InterruptUnlock() reenable the irq’s?

-Michael

Michael Tasche <michael.tasche@esd-electronics.com> wrote:

Is following possible?

InterruptLock( &a );

InterruptLock( &b );

InterruptUnlock( &b);

InterruptUnlock( &a);

Does the first InterruptUnlock() reenable the irq’s?

Yes. InterruptLock/Unlock (and the same with the non-SMP versions
InterruptDisable/Enable) do not nest. If you can deal with only
disabling one interrupt level, you can look at InterruptMask/Unmask
which do nest.

\

Brian Stecher (bstecher@qnx.com) QNX Software Systems, Ltd.
phone: +1 (613) 591-0931 (voice) 175 Terence Matthews Cr.
+1 (613) 591-3579 (fax) Kanata, Ontario, Canada K2M 1W8

On Mon, 03 Nov 2003 14:22:52 +0100, peter
<pw@_remove_inclusive_underscore_dolphin.de> wrote:

Michael, the argument of InterruptLock/Unlock is a spinlock,
not an irq.
The InterruptLock is used to acquire an spinlock (used between
threads and isr-handler. A kind of mutex but available in a
thread AND in an irq.
InterruptLock/Unlock has nothing to do with irq enable/disable.

Wrong: InterruptLock disables the irq on the local cpu and than aquires
the spinlock!
InterruptUnlock unlocks the spinlock and than enables the irqs on
the local cpu!

-Michael

cheers, peter



Michael Tasche wrote:
Hi all,

Is following possible?

InterruptLock( &a );

InterruptLock( &b );

InterruptUnlock( &b);

InterruptUnlock( &a);


Does the first InterruptUnlock() reenable the irq’s?

-Michael

bstecher@qnx.com wrote:

Michael Tasche <> michael.tasche@esd-electronics.com> > wrote:
Is following possible?

InterruptLock( &a );

InterruptLock( &b );

InterruptUnlock( &b);

InterruptUnlock( &a);

Does the first InterruptUnlock() reenable the irq’s?

Yes. InterruptLock/Unlock (and the same with the non-SMP versions
InterruptDisable/Enable) do not nest. If you can deal with only
disabling one interrupt level, you can look at InterruptMask/Unmask
which do nest.

And any kernel call will (as a side-effect) re-enable interrupts.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Do you really need to prevent interrupts? That’s very unusual
under QNX, unless you’re doing something exotic in a driver that
has a huge interrupt load.

John Nagle

Michael Tasche wrote:

Hi all,

Is following possible?

InterruptLock( &a );

InterruptLock( &b );

InterruptUnlock( &b);

InterruptUnlock( &a);


Does the first InterruptUnlock() reenable the irq’s?

-Michael

On 3 Nov 2003 18:01:22 GMT, David Gibbs <dagibbs@qnx.com> wrote:

bstecher@qnx.com > wrote:
Michael Tasche <> michael.tasche@esd-electronics.com> > wrote:
Is following possible?

InterruptLock( &a );

InterruptLock( &b );

InterruptUnlock( &b);

InterruptUnlock( &a);

Does the first InterruptUnlock() reenable the irq’s?

Yes. InterruptLock/Unlock (and the same with the non-SMP versions
InterruptDisable/Enable) do not nest. If you can deal with only
disabling one interrupt level, you can look at InterruptMask/Unmask
which do nest.

And any kernel call will (as a side-effect) re-enable interrupts.

That is ok, I don’t want to call the kernel during an OFF-Sequence.
-Michael

-David

On Tue, 04 Nov 2003 00:06:33 -0800, John Nagle <nagle@downside.com> wrote:

Do you really need to prevent interrupts? That’s very unusual
under QNX, unless you’re doing something exotic in a driver that
has a huge interrupt load.
Well, most of our drivers have a short critical path against their

ISR-Routines.

-Michael

John Nagle

Michael Tasche wrote:
Hi all,

Is following possible?

InterruptLock( &a );

InterruptLock( &b );

InterruptUnlock( &b);

InterruptUnlock( &a);


Does the first InterruptUnlock() reenable the irq’s?

-Michael