summaryrefslogtreecommitdiffstats
path: root/lib/libc/include
diff options
context:
space:
mode:
authorjb <jb@FreeBSD.org>1998-06-09 08:28:49 +0000
committerjb <jb@FreeBSD.org>1998-06-09 08:28:49 +0000
commitfe07ac9fc2e529230108c3d5d61da473552a922c (patch)
tree3332055d0c9769909106206a69f01f5afd2ab0ef /lib/libc/include
parentffa72784691e6ee8eb7938c8910724280ad309cb (diff)
downloadFreeBSD-src-fe07ac9fc2e529230108c3d5d61da473552a922c.zip
FreeBSD-src-fe07ac9fc2e529230108c3d5d61da473552a922c.tar.gz
Implement compile time debug support for spinlocks.
Simplify the atomic lock prototype, removing the lock value. Delete the unlock prototypes that are not required.
Diffstat (limited to 'lib/libc/include')
-rw-r--r--lib/libc/include/spinlock.h29
1 files changed, 24 insertions, 5 deletions
diff --git a/lib/libc/include/spinlock.h b/lib/libc/include/spinlock.h
index 50843ce..e313684 100644
--- a/lib/libc/include/spinlock.h
+++ b/lib/libc/include/spinlock.h
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: spinlock.h,v 1.1 1998/03/09 05:05:32 jb Exp $
+ * $Id: spinlock.h,v 1.2 1998/05/05 21:46:30 jb Exp $
*
* Lock definitions used in both libc and libpthread.
*
@@ -38,15 +38,34 @@
#ifndef _SPINLOCK_H_
#define _SPINLOCK_H_
#include <sys/cdefs.h>
+#include <sys/types.h>
+
+/*
+ * Lock structure with room for debugging information.
+ */
+typedef struct {
+ volatile long access_lock;
+ volatile long lock_owner;
+ volatile char *fname;
+ volatile int lineno;
+} spinlock_t;
+
+#define _SPINLOCK_INITIALIZER { 0, 0, 0, 0 }
+
+#define _SPINUNLOCK(_lck) (_lck)->access_lock = 0
+#ifdef _LOCK_DEBUG
+#define _SPINLOCK(_lck) _spinlock_debug(_lck, __FILE__, __LINE__)
+#else
+#define _SPINLOCK(_lck) _spinlock(_lck)
+#endif
/*
* Thread function prototype definitions:
*/
__BEGIN_DECLS
-long _atomic_lock __P((volatile long *, long));
-long _atomic_unlock __P((volatile long *));
-void _spinlock __P((volatile long *));
-void _spinunlock __P((volatile long *));
+long _atomic_lock __P((volatile long *));
+void _spinlock __P((spinlock_t *));
+void _spinlock_debug __P((spinlock_t *, char *, int));
__END_DECLS
#endif /* _SPINLOCK_H_ */
OpenPOWER on IntegriCloud