Re: interrupt handler

Kerenyi Gabor (wom@tateyama.hu)
Fri, 23 Aug 2002 13:58:01 +0900


8/23/2002 8:58:20 PM, "sanket rathi" <sanket@linuxmail.org> wrote:

>hi,
>Can i use spin lock in the interrupt handler for a singlre processor machine. because books says u can not use locks
>but spin lock is some thing diffrent

Yes you can. Spinlocks will be compiled in if you choose SMP even on single processor machine.
But look at the documentation in the kernel source.
I think "lock" in your message is a semaphore in real life.

Spinlocks never sleep - they don't perform task switch and you can use them anywhere, while semaphores
can sleep and you can use them only in user context (not in interrupt or bottom half)

Gabor

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/