lkml.org 
[lkml]   [2005]   [Oct]   [15]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateSat, 15 Oct 2005 00:58:51 -0700
FromMitchell Blank Jr <>
SubjectRe: lock_kernel twice possible ?
li nux wrote:
> Sorry, couldn't get what you want to say.
> Can you please elaborate.

A "recursive lock" is one that can be taken multiple times by the same
owner.  So:

	lock_kernel();
	lock_kernel();
	unlock_kernel();
	unlock_kernel();

is perfectly ok.  The lock_kernel() code detects that the calling thread
already owns the lock and just increments current->lock_depth.

Under linux locks are non-recursive EXCEPT for lock_kernel() (aka the BLK
or "big kernel lock")

See lib/kernel_lock.c for more details.

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

\
 
 \ /
  Last update: 2005-10-15 07:48    [from the cache]
©2003-2008