H
hellotao
Unregistered / Unconfirmed
GUEST, unregistred user!
功能是寻找当前线程的最大值加一, 我想应该是的吧
{ 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;
{ 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;