Hi In my multithreaded application some threads (and MainThread, ofcourse) are accessing to global string variable. Additional threads only read the value, but the main thread can change them. May be, i still need to use Synchronize?
Mr. David, what will tell You?
var
maillist:tstringlist;
mindex:integer; // global variables.
procedure TMultiThread.Execute;
begin
while true do
begin
if (icount>=0) or (terminated) then
exit;
try
sec.enter; // critical section
login := maillist.names[mIndex];
UniqueString(login);
password:=maillist.ValueFromIndex[mIndex];
UniqueString(password);
interlockedincrement(mindex);
finally
sec.leave;
end;
if terminated then exit;
if (login=emptystr) or (password=emptystr) then
continue;