X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=Documentation%2FDocBook%2Fkernel-locking.tmpl;h=2510763295d09dfbd893e288d1948c9b05feda4d;hb=ff877ea80efa2015b6263766f78ee42c2a1b32f9;hp=77c42f40be5d66ecb0b2235ef3dd1300301eafa8;hpb=d02aacff4467806ee56f147ac8eff6911d95811a;p=linux-2.6-omap-h63xx.git diff --git a/Documentation/DocBook/kernel-locking.tmpl b/Documentation/DocBook/kernel-locking.tmpl index 77c42f40be5..2510763295d 100644 --- a/Documentation/DocBook/kernel-locking.tmpl +++ b/Documentation/DocBook/kernel-locking.tmpl @@ -703,6 +703,31 @@ + + The trylock Functions + + There are functions that try to acquire a lock only once and immediately + return a value telling about success or failure to acquire the lock. + They can be used if you need no access to the data protected with the lock + when some other thread is holding the lock. You should acquire the lock + later if you then need access to the data protected with the lock. + + + + spin_trylock() does not spin but returns non-zero if + it acquires the spinlock on the first try or 0 if not. This function can + be used in all contexts like spin_lock: you must have + disabled the contexts that might interrupt you and acquire the spin lock. + + + + mutex_trylock() does not suspend your task + but returns non-zero if it could lock the mutex on the first try + or 0 if not. This function cannot be safely used in hardware or software + interrupt contexts despite not sleeping. + + + Common Examples