diff --git a/pa3.c b/pa3.c
index 634dd81fb63c9c149818ee34e86d3dab90592d69..bf77e96d031ef8c651bff3051b42180e09b62653 100644
--- a/pa3.c
+++ b/pa3.c
@@ -33,7 +33,7 @@
  * Spinlock implementation
  *********************************************************************/
 struct spinlock {
-
+	int held;
 };
 
 /*********************************************************************
@@ -44,6 +44,7 @@ struct spinlock {
  */
 void init_spinlock(struct spinlock *lock)
 {
+	lock->held=0;
 	return;
 }
 
@@ -58,6 +59,8 @@ void init_spinlock(struct spinlock *lock)
  */
 void acquire_spinlock(struct spinlock *lock)
 {
+	while(lock->held);
+	lock->held=1;
 	return;
 }
 
@@ -72,6 +75,7 @@ void acquire_spinlock(struct spinlock *lock)
  */
 void release_spinlock(struct spinlock *lock)
 {
+	lock->held = 0;
 	return;
 }