diff --git a/src/sys/include/ubixos/spinlock.h b/src/sys/include/ubixos/spinlock.h index 5d6b0e2..356bf28 100644 --- a/src/sys/include/ubixos/spinlock.h +++ b/src/sys/include/ubixos/spinlock.h @@ -40,12 +40,18 @@ void spinUnlock(spinLock_t *); int spinTryLock(spinLock_t *); void spinLock(spinLock_t *); + +void spinLock_scheduler(spinLock_t *); /* Only use this spinlock in the sched. */ + int spinLockLocked(spinLock_t *); #endif /*** $Log$ + Revision 1.5 2004/07/20 20:25:57 reddawg + Works perfectly here + Revision 1.4 2004/07/20 20:20:19 reddawg spinlock: made them non inline functions I think this actually fixed the problem diff --git a/src/sys/kernel/spinlock.c b/src/sys/kernel/spinlock.c index 1113048..6fffa12 100644 --- a/src/sys/kernel/spinlock.c +++ b/src/sys/kernel/spinlock.c @@ -55,9 +55,18 @@ void spinLock(spinLock_t *lock) { while (!spinTryLock(lock)) + { + while (*lock == 1) + sched_yield(); + } +} + +void spinLock_scheduler(spinLock_t *lock) { + while (!spinTryLock(lock)) while (*lock == 1); } + int spinLockLocked(spinLock_t *lock) { return(*lock != 0); } @@ -65,6 +74,9 @@ /*** $Log$ + Revision 1.13 2004/07/29 21:32:16 reddawg + My quick lunchs breaks worth of updates.... + Revision 1.12 2004/07/28 22:35:24 reddawg ok couldn't resist last commit hopefully it doesnt cause any bugs but if it does in spinlock.c take the while (*lock == 1) schedYield(); and just make it