root/Whitix/trunk/include/spinlock.h

Revision 672, 451 bytes (checked in by mwhitworth, 4 years ago)

Add to spinlock code, including disabling of preemption.

Line 
1#ifndef SPINLOCK_H
2#define SPINLOCK_H
3
4#include <preempt.h>
5
6/* More of a per-arch thing */
7struct SpinlockTag
8{
9        DWORD flags;
10};
11
12typedef struct SpinlockTag Spinlock;
13
14#define SpinlockIrqSave(sLock)
15#define SpinlockIrqRestore(sLock)
16#define SpinLockIrq(sLock) IrqSaveFlags((sLock)->flags)
17#define SpinUnlockIrq(sLock) IrqRestoreFlags((sLock)->flags)
18#define SpinLock(sLock) \
19        PreemptDisable()
20
21#define SpinUnlock(sLock) \
22        PreemptEnable()
23
24#endif
Note: See TracBrowser for help on using the browser.