Code Search for Developers
 
 
  

linux-lock.c from CQual at Krugle


Show linux-lock.c syntax highlighted

typedef struct {
  volatile unsigned int lock;
} spinlock_t;

#define SPIN_LOCK_UNLOCKED ($unlocked spinlock_t) { 1 }
#define spin_lock(x) (({assert_type(*(x), $unlocked spinlock_t); change_type(*(x), $locked spinlock_t);}))
#define spin_unlock(x) (({assert_type(*(x), $locked spinlock_t); change_type(*(x), $unlocked spinlock_t);}))

static spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED;

int main(void) {
  rtc_lock;
  spin_lock(&rtc_lock);
  rtc_lock;
  spin_unlock(&rtc_lock);
  rtc_lock;
}




See more files for this project here

CQual

CQual - A tool for adding type qualifiers to C

Project homepage: http://sourceforge.net/projects/cqual
Programming language(s): C,Java,Shell Script
License: other

  README
  linux-lock.c
  linux-lock.i
  linux-lock2.c
  linux-lock2.i
  lock.c
  lock2.c
  lock3.c
  rcs1.c
  rcs2.c
  rcs3.c
  taint-cast.c
  taint-const-subtyping.c
  taint-poly.c
  taint-varargs.c
  taint0.c
  taint1.c
  taint2.c
  user0.c
  user1.c
  y2k1.c
  y2k2.c
  y2k3.c
  y2k4.c