Ошибка в многопоточном приложении

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by bertys, 5 Aug 2012.

  1. bertys

    bertys New Member

    Joined:
    25 Jan 2012
    Messages:
    162
    Likes Received:
    0
    Reputations:
    0
    Здравствуйте, как избавится от этой ошибки:

    [​IMG]


    Вот часть потока:
    PHP:
     begin
      http
    :=tidhttp.Create(nil);
      
    ssl:=tIdIOHandlerStack.Create(nil);
      
    socksinfo:=tidSocksInfo.Create(nil);
      
    Cookie:=tIdCookieManager.Create(nil);
      
    http.HandleRedirects:=true;
      
    http.AllowCookies:=true;
      
    http.CookieManager:=Cookie;
      
    http.IOHandler:=ssl;
      
    ssl.TransparentProxy:=socksinfo;
      
    socksinfo.Version:=svSocks5;
       
    p:=0;
     
    end;
    while 
    Work do
      
    begin
       CS
    .Enter;
       
    Inc(Acc);
       if 
    kilk<count then  Curkilk:=kilk else  Work:=false;
       if 
    Acc<>Accounts.Count+1 then CurAcc:=Acc else   curacc:=0;
       
    CS.Leave;

       if 
    Work then
        begin
         FHost
    := Copy(Accounts[CurAcc],1,Pos(':',Accounts[CurAcc])-1);
         
    FPort:= Copy(Accounts[CurAcc],Pos(':',Accounts[CurAcc])+1,Length(Accounts[CurAcc]));
    socksinfo.Port:=strtoint(FPort);
    socksinfo.Host:=FHost;
    begin
    {CS2}
    CS2.Enter;
    if 
    not(p=0then
    begin
    Inc
    (p);
    page:=inttostr(p)+'0';
    end
    else page:=inttostr(p);
    CS2.Leave;
    {/
    CS2}
    s:=http.Get('http://sait.ru/page'+page);
      while (
    posex(chtoto',s,1)<>0) do
      begin
      CS1.Enter;
      inc(kilk);
      CS1.Leave;
      start:= posex('
    chtoto',s,1);
      delete(s,1,start);
      the_end:= posex('
    ?',s,1)-1;
      u:=copy(s,1,the_end);
      url[kilk]:=URLDecode(u);
      synchronize(rezult);
        end;
    p:=p+1;
    end;
    end;
    end;
    end;
    Зарание спасибо
     
  2. shadowrun

    shadowrun Banned

    Joined:
    29 Aug 2010
    Messages:
    842
    Likes Received:
    170
    Reputations:
    84
    Снова над кодом zdezbilya издеваются...
    Acc<>Accounts.Count+1 видимо нужно Acc<>Accounts.Count-1