lkml.org 
[lkml]   [1999]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: deadlock avoidance?
On Wed, Dec 08, 1999, Davide Libenzi <dlibenzi@maticad.it> wrote:
>
> spin_lock_irqsave() guaranteed that only an uninterrupted CPU execute the
> code protected by the lock.
> See at this implementation ( optimization = 0.0 ) :
>
> struct s_nested_lock {
> spinlock_t lock;
> short int pid;
> short int count;
> };
>
>
> #define nested_lock(lock, flags) \
> if (lock->pid == getpid()) { \
> ++lock->count; \
> } else { \
> spin_lock_irqsave(&lock->lock, flags); \
> lock->pid = getpid(); \
> }
>
> #define nested_unlock(lock, flags) \
> if (--lock->count == 0) { \
> lock->pid = 0; \
> spin_unlock_irqrestore(&lock->lock, flags); \
> }

What's the pid if we interrupt the idle task?

Is it unique for each CPU?

JE


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

\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.049 / U:6.264 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site