<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Thread Killen]]></title><description><![CDATA[<p>Ich hab 2 Threads.Der eine als TimeOut überwachung. Wie kann ich den ersten Thread über den zweiten beenden.Bitte mit kleinem Bsp. da noch beginner.</p>
<pre><code class="language-cpp">CWinThread* pThread1 = AfxBeginThread (thr1, this);// Eigentliche Funktion
CWinThread* pThread2 = AfxBeginThread (thrTimeOut, this);// TimeOut überwachung

void CTestDlg::thrTimeOut()
{
     Sleep(2000);
     if(irgendwas == nicht i.o.)
     {
         Kille Thread1
      // Was kommt hier rein ??
     }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/6366/thread-killen</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 22:17:35 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/6366.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 24 Jun 2003 18:40:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Thread Killen on Tue, 24 Jun 2003 18:40:00 GMT]]></title><description><![CDATA[<p>Ich hab 2 Threads.Der eine als TimeOut überwachung. Wie kann ich den ersten Thread über den zweiten beenden.Bitte mit kleinem Bsp. da noch beginner.</p>
<pre><code class="language-cpp">CWinThread* pThread1 = AfxBeginThread (thr1, this);// Eigentliche Funktion
CWinThread* pThread2 = AfxBeginThread (thrTimeOut, this);// TimeOut überwachung

void CTestDlg::thrTimeOut()
{
     Sleep(2000);
     if(irgendwas == nicht i.o.)
     {
         Kille Thread1
      // Was kommt hier rein ??
     }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/30848</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30848</guid><dc:creator><![CDATA[tagra]]></dc:creator><pubDate>Tue, 24 Jun 2003 18:40:00 GMT</pubDate></item><item><title><![CDATA[Reply to Thread Killen on Tue, 24 Jun 2003 19:09:00 GMT]]></title><description><![CDATA[<p>Du brauchst die TerminateThread Funktion. <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/terminatethread.asp" rel="nofollow">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/terminatethread.asp</a></p>
<pre><code class="language-cpp">BOOL TerminateThread(
  HANDLE hThread,
  DWORD dwExitCode
);
</code></pre>
<p>fürs Handle benutze einfach die m_hThread Membervariable der CWinThread Klasse</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30849</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30849</guid><dc:creator><![CDATA[Shlo]]></dc:creator><pubDate>Tue, 24 Jun 2003 19:09:00 GMT</pubDate></item><item><title><![CDATA[Reply to Thread Killen on Tue, 24 Jun 2003 20:10:00 GMT]]></title><description><![CDATA[<p>Kannst Du das noch etwas genauer erklären ??</p>
<p>THX</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30850</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30850</guid><dc:creator><![CDATA[tagra]]></dc:creator><pubDate>Tue, 24 Jun 2003 20:10:00 GMT</pubDate></item><item><title><![CDATA[Reply to Thread Killen on Wed, 25 Jun 2003 06:45:00 GMT]]></title><description><![CDATA[<p>Was ist denn unklar?</p>
<pre><code class="language-cpp">CWinThread* pThread1 = AfxBeginThread (thr1, this);// Eigentliche Funktion
CWinThread* pThread2 = AfxBeginThread (thrTimeOut, this);// TimeOut überwachung

//...

void CTestDlg::thrTimeOut()
{
    Sleep(2000);

    if (/*something isn't ok, do...*/) {
        pThread1-&gt;m_bAutoDelete = TRUE;
        TerminateThread(pThread1-&gt;m_hThread,0);
    }
}
</code></pre>
<p>[ Dieser Beitrag wurde am 25.06.2003 um 08:46 Uhr von <strong>Shlo</strong> editiert. ]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30851</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30851</guid><dc:creator><![CDATA[Shlo]]></dc:creator><pubDate>Wed, 25 Jun 2003 06:45:00 GMT</pubDate></item><item><title><![CDATA[Reply to Thread Killen on Wed, 25 Jun 2003 06:51:00 GMT]]></title><description><![CDATA[<p>!!! Ein Thread sollte NUR IN DEN SELTENSTEN Fällen terminiert werden !!!</p>
<p>Da ein Thread meist eine lange Schleife darstellt, kann man doch das Timeout in diese Schleife setzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30852</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30852</guid><dc:creator><![CDATA[RenéG]]></dc:creator><pubDate>Wed, 25 Jun 2003 06:51:00 GMT</pubDate></item><item><title><![CDATA[Reply to Thread Killen on Wed, 25 Jun 2003 15:26:00 GMT]]></title><description><![CDATA[<p>Mein Problem ist aber, das ich in einem Thread Daten aus dem I-Net erwarte. Kommt aber nix hägt mein Thread da fest.</p>
<pre><code class="language-cpp">void CTestDlg::thr1()
{
    Connect = &quot;http://www.test.de/test.txt&quot;; 
    CInternetSession session;
    CStdioFile* emm=session.OpenURL(Connect,1, INTERNET_FLAG_TRANSFER_BINARY);

    emm-&gt;Read (DATEN,2048); // Hier hängt es sich logischerweise auf,wenn
                            // keine Daten ankommen!
}
</code></pre>
<p>Wie kann ich das sonst eleganter lösen ??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30853</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30853</guid><dc:creator><![CDATA[tagra]]></dc:creator><pubDate>Wed, 25 Jun 2003 15:26:00 GMT</pubDate></item><item><title><![CDATA[Reply to Thread Killen on Wed, 25 Jun 2003 16:03:00 GMT]]></title><description><![CDATA[<p>Lies Dir mal was über ReadFile und dort das Zeuch über die OVERLAPPED Struktur durch.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30854</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30854</guid><dc:creator><![CDATA[Frank ll]]></dc:creator><pubDate>Wed, 25 Jun 2003 16:03:00 GMT</pubDate></item><item><title><![CDATA[Reply to Thread Killen on Thu, 26 Jun 2003 16:17:00 GMT]]></title><description><![CDATA[<p>Hm, komme irgendwie nicht weiter.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30855</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30855</guid><dc:creator><![CDATA[tagra]]></dc:creator><pubDate>Thu, 26 Jun 2003 16:17:00 GMT</pubDate></item><item><title><![CDATA[Reply to Thread Killen on Fri, 27 Jun 2003 14:53:00 GMT]]></title><description><![CDATA[<p>Hab zwar allerhand gelesen aber nix verstanden. Hat nicht irgend jemand ne idee.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30856</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30856</guid><dc:creator><![CDATA[tagra]]></dc:creator><pubDate>Fri, 27 Jun 2003 14:53:00 GMT</pubDate></item><item><title><![CDATA[Reply to Thread Killen on Sat, 28 Jun 2003 06:34:00 GMT]]></title><description><![CDATA[<p>Bevor du mit Threads und Sockets was machts nimm lieber die Klasse<br />
CAsyncSocket<br />
Die erledigt das für dich.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/30857</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/30857</guid><dc:creator><![CDATA[Unix-Tom]]></dc:creator><pubDate>Sat, 28 Jun 2003 06:34:00 GMT</pubDate></item></channel></rss>