<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=193763&amp;view=findpost&amp;p=1624802</guid>
        <pubDate>Thu, 05 Jul 2007 08:53:16 +0000</pubDate>
        <title>Thread Error</title>
        <link>https://forum.sources.ru/index.php?showtopic=193763&amp;view=findpost&amp;p=1624802</link>
        <description><![CDATA[Domino: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=193763&view=findpost&p=1624485'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Демо &#064; <time class="tag-quote__quoted-time" datetime="2007-07-05T09:50:06+04:00">05.07.07, 05:50</time></span><div class='quote '>здесь основной код, который смотреть надо</div></div><br>
В TSnThread.Execute находится причина подвисания при завершении.<br>
<br>
А уничтожать поток нужно так:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;&nbsp;if FSnThread &#60;&#62; nil then</div><div class="code_line">&nbsp;&nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp;FSnThread.Terminate;</div><div class="code_line">&nbsp;&nbsp; &nbsp;FSnThread := nil;</div><div class="code_line">&nbsp;&nbsp; &nbsp;Button1.Caption := &#39;Start&#39;;</div><div class="code_line">&nbsp;&nbsp;end else</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script>]]></description>
        <author>Domino</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=193763&amp;view=findpost&amp;p=1624485</guid>
        <pubDate>Thu, 05 Jul 2007 05:50:06 +0000</pubDate>
        <title>Thread Error</title>
        <link>https://forum.sources.ru/index.php?showtopic=193763&amp;view=findpost&amp;p=1624485</link>
        <description><![CDATA[Демо: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=193763&view=findpost&p=1624441'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>WiseFalcon &#064; <time class="tag-quote__quoted-time" datetime="2007-07-05T04:07:50+00:00">05.07.07, 04:07</time></span><div class='quote '>  try<br>
    while not Terminated do<br>
    begin<br>
     //&#33;&#33;&#33;  ЗДЕСЬ Я ВСЕ ЗАКОНСПЕКТИРОВАЛ&#33;&#33; А Ошибка осталась..<br>
    end;<br>
  finally<br>
    {Здесь тоже}<br>
  end;</div></div><br>
<br>
Однако здесь основной код, который смотреть надо.]]></description>
        <author>Демо</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=193763&amp;view=findpost&amp;p=1624441</guid>
        <pubDate>Thu, 05 Jul 2007 04:07:50 +0000</pubDate>
        <title>Thread Error</title>
        <link>https://forum.sources.ru/index.php?showtopic=193763&amp;view=findpost&amp;p=1624441</link>
        <description><![CDATA[WiseFalcon: На роботу меня не взяли  :P     Поэтому выкладываю:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">...........</div><div class="code_line">&nbsp;</div><div class="code_line">type</div><div class="code_line">&nbsp;&nbsp;TSnThread = class(TThread)</div><div class="code_line">&nbsp;&nbsp;private</div><div class="code_line">&nbsp;&nbsp; &nbsp;Packet: array[0..500] of Byte;</div><div class="code_line">&nbsp;&nbsp; &nbsp;SPacket,CPacket: array[0..500] of Byte;</div><div class="code_line">&nbsp;&nbsp; &nbsp;SPOffset,CPOffset: Integer;</div><div class="code_line">&nbsp;&nbsp;protected</div><div class="code_line">&nbsp;&nbsp; &nbsp;procedure Execute; override;</div><div class="code_line">&nbsp;&nbsp;public</div><div class="code_line">&nbsp;&nbsp; &nbsp;Htt: String;</div><div class="code_line">&nbsp;&nbsp;end;</div><div class="code_line">&nbsp;</div><div class="code_line">type</div><div class="code_line">&nbsp;&nbsp;TForm1 = class(TForm)</div><div class="code_line">&nbsp;&nbsp; &nbsp;Button1: TButton;</div><div class="code_line">&nbsp;&nbsp; &nbsp;procedure Button1Click(Sender: TObject);</div><div class="code_line">&nbsp;&nbsp;private</div><div class="code_line">&nbsp;&nbsp; &nbsp;FSnThread: TSnThread;</div><div class="code_line">&nbsp;&nbsp;end;</div><div class="code_line">&nbsp;</div><div class="code_line">...........</div><div class="code_line">&nbsp;</div><div class="code_line">procedure TSnThread.Execute;</div><div class="code_line">begin</div><div class="code_line">&nbsp;&nbsp;try</div><div class="code_line">&nbsp;&nbsp; &nbsp;while not Terminated do</div><div class="code_line">&nbsp;&nbsp; &nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; //!!! &nbsp;ЗДЕСЬ Я ВСЕ ЗАКОНСПЕКТИРОВАЛ!! А Ошибка осталась..</div><div class="code_line">&nbsp;&nbsp; &nbsp;end;</div><div class="code_line">&nbsp;&nbsp;finally</div><div class="code_line">&nbsp;&nbsp; &nbsp;{Здесь тоже}</div><div class="code_line">&nbsp;&nbsp;end;</div><div class="code_line">end;</div><div class="code_line">&nbsp;</div><div class="code_line">procedure TForm1.Button1Click(Sender: TObject);</div><div class="code_line">begin</div><div class="code_line">&nbsp;&nbsp;if FSnThread&#60;&#62;nil then</div><div class="code_line">&nbsp;&nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp;FSnThread.Destroy;</div><div class="code_line">&nbsp;&nbsp; &nbsp;FSnThread:=nil;</div><div class="code_line">&nbsp;&nbsp; &nbsp;Button1.Caption:=&#39;Start&#39;;</div><div class="code_line">&nbsp;&nbsp;end else</div><div class="code_line">&nbsp;&nbsp; begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; FSnThread:=TSnThread.Create(True);</div><div class="code_line">&nbsp;&nbsp; &nbsp; FSnThread.Htt:=&#39;455&#39;;</div><div class="code_line">&nbsp;&nbsp; &nbsp; FSnThread.SPOffset:=0;</div><div class="code_line">//ЕСЛИ СТРОЧКУ НИЖЕ убрать, все норм работает, только сильно подвисает при остановке потока (секунд на 10!!)</div><div class="code_line">&nbsp;&nbsp; &nbsp; FSnThread.FreeOnTerminate:=True; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; FSnThread.Resume;</div><div class="code_line">&nbsp;&nbsp; &nbsp; Button1.Caption:=&#39;Stop&#39;;</div><div class="code_line">&nbsp;&nbsp; end;</div><div class="code_line">end;</div><div class="code_line">&nbsp;</div><div class="code_line">end.</div></ol></div></div></div></div>]]></description>
        <author>WiseFalcon</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=193763&amp;view=findpost&amp;p=1624421</guid>
        <pubDate>Thu, 05 Jul 2007 00:43:30 +0000</pubDate>
        <title>Thread Error</title>
        <link>https://forum.sources.ru/index.php?showtopic=193763&amp;view=findpost&amp;p=1624421</link>
        <description><![CDATA[WiseFalcon: Нашел в чем проблема..<br>
Проблема была в том что у меня на потоке было установлено свойство FreeOnTerminate:=true;<br>
Получается когда переменная Terminate изменялась в true поток сам себя выгружал, а потом я его еще пытался вручную тушить..  :huh:   (скорей всего я сильно ошибаюсь)<br>
<br>
ЗЫ Только почему-то раньше это работе не мешало.. что очень подозрительно...  :blink: <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2007-07-05T00:47:13+00:00">05.07.07, 00:47</time></span></span><br>
Да и еще... теперь приложение нехило подвисает при остановке потока..  &lt;_&lt; <br>
<br>
Код ксожелению выложить немогу т.к. там очень много всякого...  выложу когда буду дома, щас некогда..]]></description>
        <author>WiseFalcon</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=193763&amp;view=findpost&amp;p=1624087</guid>
        <pubDate>Wed, 04 Jul 2007 14:18:21 +0000</pubDate>
        <title>Thread Error</title>
        <link>https://forum.sources.ru/index.php?showtopic=193763&amp;view=findpost&amp;p=1624087</link>
        <description><![CDATA[spider13: А исходник можно, а то не очень понятно]]></description>
        <author>spider13</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=193763&amp;view=findpost&amp;p=1624068</guid>
        <pubDate>Wed, 04 Jul 2007 13:50:05 +0000</pubDate>
        <title>Thread Error</title>
        <link>https://forum.sources.ru/index.php?showtopic=193763&amp;view=findpost&amp;p=1624068</link>
        <description><![CDATA[WiseFalcon: У меня следующая проблемма: При Destryct&#39;е Потока у меня возникает следующая ошибка &quot;Thread Error: Неверный дескриптор (6)&quot;. Думал что может он уже где-то выгружается - поставил Free вместо Destryct, результат тотже  :( <br>Кто сталкивался подскажите пожалуйста..<br><br>ЗЫ Вообще все работало, потом я добавил еще один поток, начала вылетать эта ошибка.. Я его удалил, а ошибка осталась..]]></description>
        <author>WiseFalcon</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      </channel>
      </rss>
	