烂
烂泥
Unregistered / Unconfirmed
GUEST, unregistred user!
demo下DB/bkquery 中的代码看不懂
var
Guard: Integer;
Numbers: Integer;
{ Thread safe increment of Numbers to guarantee the result is unique }
function GetUniqueNumber: Integer;
asm
@@1: MOV EDX,1
XCHG Guard,EDX
OR EDX,EDX
JNZ @@2
MOV EAX,Numbers
INC EAX
MOV Numbers,EAX
MOV Guard,EDX
RET
@@2: PUSH 0
CALL Sleep
JMP @@1
end;
var
Guard: Integer;
Numbers: Integer;
{ Thread safe increment of Numbers to guarantee the result is unique }
function GetUniqueNumber: Integer;
asm
@@1: MOV EDX,1
XCHG Guard,EDX
OR EDX,EDX
JNZ @@2
MOV EAX,Numbers
INC EAX
MOV Numbers,EAX
MOV Guard,EDX
RET
@@2: PUSH 0
CALL Sleep
JMP @@1
end;