nicer lock checking
authortridge <>
Thu, 21 Oct 2004 20:14:50 +0000 (20:14 +0000)
committertridge <>
Thu, 21 Oct 2004 20:14:50 +0000 (20:14 +0000)
idtree/idtree.c

index b8f13181327807d62c3d6d7c87aa2e793a6e2633..62c0e85462bacffb35b9dd8aa977609837c11467 100644 (file)
@@ -10,9 +10,9 @@
 typedef int spinlock_t;
 typedef void kmem_cache_t;
 
-#define spin_lock(x) ((*x)=1)
+#define spin_lock(x) do { if (*x) printf("already locked?!\n"); (*x)=1; } while (0)
+#define spin_unlock(x) do { if (! *x) printf("not locked?!\n"); (*x)=0; } while (0)
 #define spin_lock_init(x) ((*x)=0)
-#define spin_unlock(x) ((*x)=0)
 
 #define kmem_cache_alloc(cache, mask) calloc(1, sizeof(struct idr_layer))
 #define kmem_cache_free(cache, p) free(p)