This commit is contained in:
Russ Cox
2005-08-08 12:50:13 +00:00
parent 0189e66e88
commit 934846f35c
382 changed files with 62614 additions and 0 deletions

22
win32-386/tas.c Normal file
View File

@ -0,0 +1,22 @@
// could also use windozy InterlockedCompareExchange(p, 1, 0), but why
int
tas(long *p)
{
int v;
_asm {
mov eax, p
mov ebx, 1
xchg ebx, [eax]
mov v, ebx
}
switch(v) {
case 0:
case 1:
return v;
default:
print("canlock: corrupted 0x%lux\n", v);
return 1;
}
}