<?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 wie geht das?]]></title><description><![CDATA[<p>Wie geht das mit den Threads eigentlich richtig?</p>
<p>Aufruf:</p>
<pre><code class="language-cpp">DWORD id;
::CreateThread(0, NULL, (LPTHREAD_START_ROUTINE)testit, (LPVOID)0, NULL, &amp;id);
</code></pre>
<p>Funktion:</p>
<pre><code class="language-cpp">DWORD MyTest::testit(LPVOID)
{
//...
	return 0;
}
</code></pre>
<p>'Typumwandlung': 'overloaded-function' kann nicht in 'LPTHREAD_START_ROUTINE' konvertiert werden</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/153983/thread-wie-geht-das</link><generator>RSS for Node</generator><lastBuildDate>Thu, 23 Jul 2026 09:36:36 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/153983.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 23 Jul 2006 07:24:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Thread wie geht das? on Sun, 23 Jul 2006 07:24:03 GMT]]></title><description><![CDATA[<p>Wie geht das mit den Threads eigentlich richtig?</p>
<p>Aufruf:</p>
<pre><code class="language-cpp">DWORD id;
::CreateThread(0, NULL, (LPTHREAD_START_ROUTINE)testit, (LPVOID)0, NULL, &amp;id);
</code></pre>
<p>Funktion:</p>
<pre><code class="language-cpp">DWORD MyTest::testit(LPVOID)
{
//...
	return 0;
}
</code></pre>
<p>'Typumwandlung': 'overloaded-function' kann nicht in 'LPTHREAD_START_ROUTINE' konvertiert werden</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1102437</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102437</guid><dc:creator><![CDATA[Thr]]></dc:creator><pubDate>Sun, 23 Jul 2006 07:24:03 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Sun, 23 Jul 2006 07:35:29 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">class MyTest
{
    static DWORD WINAPI testit(LPVOID)
    {
        //...
        return 0;
    }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1102439</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102439</guid><dc:creator><![CDATA[d]]></dc:creator><pubDate>Sun, 23 Jul 2006 07:35:29 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Sun, 23 Jul 2006 07:37:51 GMT]]></title><description><![CDATA[<p>Und die unnötigen &quot;casts&quot; würde ich weglassen; das deutet meistens daraufhin, das man was falsch gemacht hat...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1102440</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102440</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Sun, 23 Jul 2006 07:37:51 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Sun, 23 Jul 2006 18:15:21 GMT]]></title><description><![CDATA[<p>Hallo und Dankeschön für die prompte Antwort <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
<p>Wie beende ich nun eigentlich den Thread sauber?<br />
Mit ExitThread vermute ich. Nur wie identifiziere<br />
ich den zu beendenden Thread?</p>
<p>Im Beispiel ist es ja &quot;id&quot;, aber jeder Aufruf mit<br />
ExitThread beendet sofort meine ganze Anwendung <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1102729</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102729</guid><dc:creator><![CDATA[Thr]]></dc:creator><pubDate>Sun, 23 Jul 2006 18:15:21 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Sun, 23 Jul 2006 18:21:26 GMT]]></title><description><![CDATA[<p>ExitThread beendet immer den aktuellen Thread (in dem die Funktion aufgerufen wird). Schau dir mal TerminateThread an der kannst du einen Handle und einen Exit-Code (also wie bei ExitThread übergeben).</p>
<p>EDIT vertipper, klammer zu <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1102736</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102736</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Sun, 23 Jul 2006 18:21:26 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Sun, 23 Jul 2006 18:42:16 GMT]]></title><description><![CDATA[<p>CodeFinder schrieb:</p>
<blockquote>
<p>TerminateThread</p>
</blockquote>
<p>Diese Funktion sollte man <strong>nie</strong> aufrufen!<br />
Siehe: Why you should never call Suspend/TerminateThread (Part I-III)<br />
<a href="http://blog.kalmbachnet.de/?postid=6" rel="nofollow">http://blog.kalmbachnet.de/?postid=6</a><br />
<a href="http://blog.kalmbachnet.de/?postid=16" rel="nofollow">http://blog.kalmbachnet.de/?postid=16</a><br />
<a href="http://blog.kalmbachnet.de/?postid=17" rel="nofollow">http://blog.kalmbachnet.de/?postid=17</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1102749</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102749</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Sun, 23 Jul 2006 18:42:16 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Sun, 23 Jul 2006 18:44:20 GMT]]></title><description><![CDATA[<p>Thr schrieb:</p>
<blockquote>
<p>Wie beende ich nun eigentlich den Thread sauber?</p>
</blockquote>
<p>Am einfachsten, indem Du aus dem Thread mit &quot;return&quot; rausgehst...</p>
<p>Du solltest aber den Thread nicht mit &quot;CreateThread&quot; sondern mit _beginthread(ex) erstellen! Oder Du stellst sicher, dass Du *keine* CRT Funktionen in denm Thread verwendest, dann kannst Du auch CreateThread verwenden.<br />
Falls Du doch CRT-Funktionen verwenden solltest, entstehts sonst ein Speicherleck.<br />
Oder Du beendest den Thread mittels _endthread(ex); dann passt es auch wieder...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1102750</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102750</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Sun, 23 Jul 2006 18:44:20 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Sun, 23 Jul 2006 19:43:01 GMT]]></title><description><![CDATA[<p>Also mit _beginthread(ex) kann ich irgendwie nicht um...</p>
<p>Gibts dazu hier im Forum keine Beispiele? Habe zumindest in der<br />
Forensuche nichts gefunden.</p>
<p>Ist es nun einfach nur unfein das auf die andere Art zu machen,<br />
sofern man diese speziellen CRT nicht nutzt, oder auch sonst grundsätzlich ernsthaft bedenklich?</p>
<p>Wie machens die Leute sonst hier im Forum?</p>
<p>Dank und Gruß<br />
Thr</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1102767</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102767</guid><dc:creator><![CDATA[Thr]]></dc:creator><pubDate>Sun, 23 Jul 2006 19:43:01 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Sun, 23 Jul 2006 20:02:31 GMT]]></title><description><![CDATA[<p>Es ist ernsthaft bedenklich, einen anderen als den eigenen Thread zu beenden. Du weißt nicht, welchen Code der andere Thread gerade ausführt und welche gemeinsam genutzten Objekte er manipuliert. Wenn du einen anderen Thread beendest, werden seine WaitHandles freigegeben und er hinterlässt unter Umständen ein Objekt, dass sich in einem inkosistenten Zustand befindet, was dann von anderen Threads so genutzt wird.</p>
<p>Es gibt keine Möglichkeit, dieses Problem zu verhindern, außer indem sich jeder Thread selbst beendet.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1102769</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102769</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sun, 23 Jul 2006 20:02:31 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Sun, 23 Jul 2006 20:17:43 GMT]]></title><description><![CDATA[<p>Jochen Kalmbach schrieb:</p>
<blockquote>
<p>Du solltest aber den Thread nicht mit &quot;CreateThread&quot; sondern mit _beginthread(ex) erstellen! Oder Du stellst sicher, dass Du *keine* CRT Funktionen in denm Thread verwendest, dann kannst Du auch CreateThread verwenden.<br />
Falls Du doch CRT-Funktionen verwenden solltest, entstehts sonst ein Speicherleck.<br />
Oder Du beendest den Thread mittels _endthread(ex); dann passt es auch wieder...</p>
</blockquote>
<p>Wann entstehen Speicherlecks? Mit welchen CRT Funktionen entstehen die und wieso? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1102778</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102778</guid><dc:creator><![CDATA[ErklärungBitte]]></dc:creator><pubDate>Sun, 23 Jul 2006 20:17:43 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Sun, 23 Jul 2006 20:27:58 GMT]]></title><description><![CDATA[<p>Kann mir bitte jemand ein Beispiel für beginthread geben?<br />
Ich versuche damit verzweifelt ne Funktion aufzurufen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1102784</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102784</guid><dc:creator><![CDATA[Thr]]></dc:creator><pubDate>Sun, 23 Jul 2006 20:27:58 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Sun, 23 Jul 2006 20:29:43 GMT]]></title><description><![CDATA[<p>Jochen Kalmbach schrieb:</p>
<blockquote>
<p>CodeFinder schrieb:</p>
<blockquote>
<p>TerminateThread</p>
</blockquote>
<p>Diese Funktion sollte man <strong>nie</strong> aufrufen!<br />
Siehe: Why you should never call Suspend/TerminateThread (Part I-III)<br />
<a href="http://blog.kalmbachnet.de/?postid=6" rel="nofollow">http://blog.kalmbachnet.de/?postid=6</a><br />
<a href="http://blog.kalmbachnet.de/?postid=16" rel="nofollow">http://blog.kalmbachnet.de/?postid=16</a><br />
<a href="http://blog.kalmbachnet.de/?postid=17" rel="nofollow">http://blog.kalmbachnet.de/?postid=17</a></p>
</blockquote>
<p>Ich weiß, das is dirty... alá &quot;Prozessstruktur beenden&quot; im TaskMgn...aber damit kann er ihn beenden <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1102786</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102786</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Sun, 23 Jul 2006 20:29:43 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Sun, 23 Jul 2006 20:31:02 GMT]]></title><description><![CDATA[<p>Thr schrieb:</p>
<blockquote>
<p>Kann mir bitte jemand ein Beispiel für beginthread geben?<br />
Ich versuche damit verzweifelt ne Funktion aufzurufen...</p>
</blockquote>
<p>Das ist doch wohl lachhaft. Benutz google oder <a href="http://koders.com" rel="nofollow">koders.com</a> um Beispiele zu finden. Alternativ könntest du auch programmieren lernen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1102787</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102787</guid><dc:creator><![CDATA[koders]]></dc:creator><pubDate>Sun, 23 Jul 2006 20:31:02 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Sun, 23 Jul 2006 20:46:29 GMT]]></title><description><![CDATA[<p>Ich dachte das Forum wäre auch Newbie-freundlich, darum habe ich das<br />
hier gepostet. Entschuldigt, falls das hier nicht hingehört.<br />
Ich habe erst mit C++ angefangen (vor knapp 2 Wochen). <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Mir ist daher nicht so ganz klar wie ich beginthread verwenden soll.<br />
Besonders, wenn ich eine einfache void-Funktion damit aufrufen will.</p>
<p>Muss man aber wohl mit Pointern innerhalb der Funktion arbeiten oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1102795</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102795</guid><dc:creator><![CDATA[Thr]]></dc:creator><pubDate>Sun, 23 Jul 2006 20:46:29 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Sun, 23 Jul 2006 21:05:21 GMT]]></title><description><![CDATA[<p>Thr schrieb:</p>
<blockquote>
<p>Kann mir bitte jemand ein Beispiel für beginthread geben?<br />
Ich versuche damit verzweifelt ne Funktion aufzurufen...</p>
</blockquote>
<p>Jop, hier: <a href="http://msdn2.microsoft.com/en-us/library/kdzttdcb.aspx" rel="nofollow">http://msdn2.microsoft.com/en-us/library/kdzttdcb.aspx</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1102805</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102805</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Sun, 23 Jul 2006 21:05:21 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Sun, 23 Jul 2006 21:16:48 GMT]]></title><description><![CDATA[<p>Hallo Codefinder!</p>
<p>Ich kann damit also keine void-Funktion aufrufen richtig?</p>
<pre><code class="language-cpp">_beginthread(lesson5, 0, 1); //lesson5 ist = void lesson5(void)
</code></pre>
<blockquote>
<p>'_beginthread': Konvertierung des Parameters 1 von 'void (void)' in 'void (__cdecl *)(void *)' nicht möglich</p>
</blockquote>
<blockquote>
<p>Start address of a routine that begins execution of a new thread. For _beginthread, the calling convention is either __cdecl or __clrcall; for _beginthreadex, it is either __stdcall or __clrcall.</p>
</blockquote>
<p>Alles noch etwas böhmische Dörfer <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1102809</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102809</guid><dc:creator><![CDATA[Thr]]></dc:creator><pubDate>Sun, 23 Jul 2006 21:16:48 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Sun, 23 Jul 2006 22:01:04 GMT]]></title><description><![CDATA[<p>Der Prototyp müsste:</p>
<pre><code class="language-cpp">void __cdecl ThreadProc( void* pvData )
</code></pre>
<p>sein.</p>
<p>EDIT: was vergessen (&quot;__cdecl&quot;)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1102814</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102814</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Sun, 23 Jul 2006 22:01:04 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Sun, 23 Jul 2006 21:57:45 GMT]]></title><description><![CDATA[<p>hmm, ändert nichts an der Meldung. Ich verstehs net.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1102828</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102828</guid><dc:creator><![CDATA[thr]]></dc:creator><pubDate>Sun, 23 Jul 2006 21:57:45 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Sun, 23 Jul 2006 22:01:37 GMT]]></title><description><![CDATA[<p>siehe EDIT, sorry</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1102830</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102830</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Sun, 23 Jul 2006 22:01:37 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Sun, 23 Jul 2006 22:14:20 GMT]]></title><description><![CDATA[<p>Ich fasse mal zusammen:</p>
<p>Der Aufruf:</p>
<pre><code class="language-cpp">_beginthread(ThreadProc,0,1);
</code></pre>
<p>Die Funktion die gerufen wird:</p>
<p>*.h</p>
<pre><code class="language-cpp">void __cdecl ThreadProc( void* pvData );
</code></pre>
<p>*.cpp</p>
<pre><code class="language-cpp">void __cdecl ThreadProc( void* pvData )
{
MessageBox(0,&quot;angekommen!&quot;,0,0);

}
</code></pre>
<p>Und das läuft bei dir <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> Bei mir liegt wohl der Fehler im<br />
ersten Parameter vom Aufruf oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1102833</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102833</guid><dc:creator><![CDATA[Thr]]></dc:creator><pubDate>Sun, 23 Jul 2006 22:14:20 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Sun, 23 Jul 2006 23:02:12 GMT]]></title><description><![CDATA[<p>Hab nit getestet...</p>
<p>Aber mal daran gedacht:</p>
<blockquote>
<p>* This program requires the multithreaded library.<br />
*<br />
* If you are using the Visual C++ development environment, select the<br />
* Multi-Threaded runtime library in the compiler Project Settings<br />
* dialog box.</p>
</blockquote>
<p>und daran:</p>
<pre><code class="language-cpp">#include &lt;process.h&gt;    /* _beginthread, _endthread */
</code></pre>
<p>Edit: Mist doppeltpost, einen löschen bitte <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1102847</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102847</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Sun, 23 Jul 2006 23:02:12 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Sun, 23 Jul 2006 23:01:34 GMT]]></title><description><![CDATA[<p>Hab nit getestet...</p>
<p>Aber mal daran gedacht:</p>
<blockquote>
<p>* This program requires the multithreaded library.<br />
*<br />
* If you are using the Visual C++ development environment, select the<br />
* Multi-Threaded runtime library in the compiler Project Settings<br />
* dialog box.</p>
</blockquote>
<p>und daran:</p>
<pre><code class="language-cpp">#include &lt;process.h&gt;    /* _beginthread, _endthread */
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1102848</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102848</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Sun, 23 Jul 2006 23:01:34 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Mon, 24 Jul 2006 07:42:46 GMT]]></title><description><![CDATA[<p>Bei mir kommt die Fehlermeldung auch! Auch mit dem Include.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1102916</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1102916</guid><dc:creator><![CDATA[Glucker]]></dc:creator><pubDate>Mon, 24 Jul 2006 07:42:46 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Mon, 24 Jul 2006 12:07:43 GMT]]></title><description><![CDATA[<p>Zeig mal deinen Code.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1103098</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1103098</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Mon, 24 Jul 2006 12:07:43 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Tue, 25 Jul 2006 00:42:16 GMT]]></title><description><![CDATA[<p>Thr schrieb:</p>
<blockquote>
<p>Ich dachte das Forum wäre auch Newbie-freundlich, darum habe ich das<br />
hier gepostet. Entschuldigt, falls das hier nicht hingehört.<br />
Ich habe erst mit C++ angefangen (vor knapp 2 Wochen). <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
</blockquote>
<p>Mit 2 Wochen C/C++-&quot;Erfahrung&quot; solltest du dich IMVHO nicht mit Threads rumschlagen...</p>
<p>Thr schrieb:</p>
<blockquote>
<p>Muss man aber wohl mit Pointern innerhalb der Funktion arbeiten oder?</p>
</blockquote>
<p>Jein.</p>
<p>Wenn du deinem Thread Daten übergeben willst kannst du das folgendermaßen bewerkstelligen:</p>
<pre><code class="language-cpp">#include &lt;stdio.h&gt;
#include &lt;process.h&gt;
#include &lt;windows.h&gt;

struct thread_data_t {

    int a;
    int b;
};

void __cdecl thread_proc( void *thread_data )
{
    printf( &quot;Die zwei Parameter, die ich bekommen habe, lauten %i und %i.\n&quot;,
            ( ( thread_data_t* )thread_data )-&gt;a,
            ( ( thread_data_t* )thread_data )-&gt;b );
}

int main( )
{
    thread_data_t thread_data;
    thread_data.a = 10;
    thread_data.b = 20;

    _beginthread( thread_proc, 0, &amp;thread_data );

    printf( &quot;Ich wart' mal eine Sekunde...\n&quot; );
    Sleep( 1000 );
}
</code></pre>
<p>Natürlich musst du dein Programm mit der Multithread-Version der CRT linken. Wie das geht verrät dir die Dokumentation deines Compilers.</p>
<p>Greetz, Swordfish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1103534</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1103534</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Tue, 25 Jul 2006 00:42:16 GMT</pubDate></item><item><title><![CDATA[Reply to Thread wie geht das? on Tue, 25 Jul 2006 07:30:21 GMT]]></title><description><![CDATA[<p>das thread_data objekt sollte man aber in den meisten fällen auf dem heap anlegen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1103575</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1103575</guid><dc:creator><![CDATA[............]]></dc:creator><pubDate>Tue, 25 Jul 2006 07:30:21 GMT</pubDate></item></channel></rss>