Re: lock_kernel check...

From: Zwane Mwaikambo (zwane@linuxpower.ca)
Date: Tue Jul 09 2002 - 05:31:30 EST


On Tue, 9 Jul 2002, Dave Hansen wrote:

> It isn't absoulutely a bad thing to return while you have a lock held.
> It might be hard to understand, or even crazy, but not immediately
> wrong :)
>
> // BKL protects both "a", and io port 0xF00D
> bar()
> {
> lock_kernel();
> return inb(0xF00D);
> }
>
> int a;
> foo()
> {
> a = bar();
> a--;
> unlock_kernel();
> }

But broken nonetheless, that kinda thing just looks ugly. Especially when
someone tries to call bar multiple times or consecutively or with the lock
already held or...

        Zwane Mwaikambo

-- 
function.linuxpower.ca

- 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/



This archive was generated by hypermail 2b29 : Mon Jul 15 2002 - 22:00:14 EST