Pastebin
Paste #441: thread race
< previous paste - next paste>
Pasted by Flawless
procedure SetGlobal(X: XInt);
begin
SomeGlobalVar := X;
end;
function ThreadTest2(Sender: Pointer): DWord; stdcall;
begin
SetGlobal(GlobalTestValue);
SetGlobal(GlobalTestValue);
SetGlobal(GlobalTestValue);
SetGlobal(GlobalTestValue);
SetGlobal(GlobalTestValue);
Result := 2;
ExitThread(4);
end;
{ test }
begin
H := CreateThread(nil, 1024*10, @ThreadTest2, nil, 0, nil);
TerminateThread(H, xsOK);
WaitForSingleObject(H, INFINITE);
GetExitCodeThread(H, U);
end;
New Paste
Go to most recent paste.