
#ifndef _SPINLOCK_H
#define _SPINLOCK_H

#include <ubixos/types.h>
#define SPIN_LOCK_INITIALIZER 0

typedef struct _spinLock spinLock_t;
struct _spinLock
{
        spinLock_t      *First;
        spinLock_t      *Last;
        spinLock_t      *Next;
        spinLock_t      *Previous;
        uInt8           *Locked;
	uInt32		*ID;
	uInt8		*Type;
};

void spinLockInit(spinLock_t *);
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.6  2004/09/11 13:01:05  apwillia
 Make spinlock lock function sched_yield.  Add spinlockLock_scheduler for use in smp-scheduler (avoids recursive call to sched).

 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

 Revision 1.3  2004/05/21 12:42:32  reddawg
 Cleaned Up


 END
 ***/

