<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Question on return value of al_create_thread</title>
		<link>http://www.allegro.cc/forums/view/613348</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Tue, 08 Oct 2013 16:26:29 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Anyone know what the void* return value is for? What are you supposed to return from your thread process?<br /><span class="source-code"><a href="http://www.allegro.cc/manual/al_create_thread"><span class="a">al_create_thread</span></a></span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sun, 06 Oct 2013 07:16:00 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I believe it&#39;s just whatever you want to return.<br />To actually get a return value you&#39;d need to use <span class="source-code"><a href="http://www.allegro.cc/manual/al_join_thread"><span class="a">al_join_thread</span></a></span>.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (l j)</author>
		<pubDate>Sun, 06 Oct 2013 07:20:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Your supposed to return the thread id so another thread can manage it and eventually stall/cancel it.</p><p>Edit: seeing the prototype and the definition, I think the documentation is somewhat wrong. </p><div class="source-code snippet"><div class="inner"><pre><span class="c">// does not really return 'true' but a valid ALLEGRO_THREAD or NULL; imho</span>
<a href="http://www.allegro.cc/manual/ALLEGRO_THREAD"><span class="a">ALLEGRO_THREAD</span></a> <span class="k3">*</span><a href="http://www.allegro.cc/manual/al_create_thread"><span class="a">al_create_thread</span></a><span class="k2">(</span><span class="k1">void</span> <span class="k3">*</span><span class="k2">(</span><span class="k3">*</span>proc<span class="k2">)</span><span class="k2">(</span><a href="http://www.allegro.cc/manual/ALLEGRO_THREAD"><span class="a">ALLEGRO_THREAD</span></a> <span class="k3">*</span>thread, <span class="k1">void</span> <span class="k3">*</span>arg<span class="k2">)</span>, <span class="k1">void</span> <span class="k3">*</span>arg<span class="k2">)</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (GullRaDriel)</author>
		<pubDate>Mon, 07 Oct 2013 04:01:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/613348/991091#target">GullRaDriel</a> said:</div><div class="quote"><p>Your supposed to return the thread id so another thread can manage it and eventually stall/cancel it.</p></div></div><p>Once you return from your function, the thread is done. So that wouldn&#39;t really do what you think <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Mon, 07 Oct 2013 04:06:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/613348/991091#target">GullRaDriel</a> said:</div><div class="quote"><p> Edit: seeing the prototype and the definition, I think the documentation is somewhat wrong.</p></div></div><p>This discussion is about the return value of the <span class="source-code">proc</span> callback (i.e., the thread function), not the return value of <span class="source-code"><a href="http://www.allegro.cc/manual/al_create_thread"><span class="a">al_create_thread</span></a><span class="k2">(</span><span class="k2">)</span></span> (which is what you are describing).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Mon, 07 Oct 2013 04:07:54 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="https://www.allegro.cc/manual/al_create_thread">al_create_thread</a> said:</div><div class="quote"><p>
Spawn a new thread which begins executing proc. The new thread is passed its own thread handle and the value arg.</p><p>Returns true if the thread was created, false if there was an error.
</p></div></div><p>

Well, it doesn&#39;t actually begin executing proc until you call <span class="source-code"><a href="http://www.allegro.cc/manual/al_start_thread"><span class="a">al_start_thread</span></a></span>. And it doesn&#39;t return true, it&#39;s a pointer to a newly created ALLEGRO_THREAD or zero (null) like Gull said.</p><p>It would sound better like :</p><p><i>Create a new thread which will run proc later when you call al_start_thread. The thread is passed its own thread handle and the value arg.</i></p><p><i>Returns a pointer to a newly created ALLEGRO_THREAD, or NULL if there was an error.</i></p><p>How does that sound?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Mon, 07 Oct 2013 15:21:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I feel understood. Thanks Edgar. The two other are just reluctant trolls ;-p
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (GullRaDriel)</author>
		<pubDate>Tue, 08 Oct 2013 01:57:56 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/613348/991133#target">GullRaDriel</a> said:</div><div class="quote"><p>I feel understood. Thanks Edgar. The two other are just reluctant trolls ;-p</p></div></div><p>
Actually, I just didn&#39;t really understand what you were trying to say.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Tue, 08 Oct 2013 02:13:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Apparently I&#39;m incapable of parsing human languages.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (l j)</author>
		<pubDate>Tue, 08 Oct 2013 02:17:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Don&#39;t worry, you&#39;re not the only one with poor reading comprehension. Sometimes I think my brain just makes up what other people said.</p><p>What format are Allegro&#39;s docs in? I will submit a patch if its not too complex.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Tue, 08 Oct 2013 03:51:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>To be honest, I had assumed Gull was talking about the user function, because you (Edgar) were.</p><p>I don&#39;t think that&#39;s an entirely unreasonable thing to think.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Tue, 08 Oct 2013 04:00:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/613348/991138#target">Edgar Reynaldo</a> said:</div><div class="quote"><p>What format are Allegro&#39;s docs in? I will submit a patch if its not too complex. </p></div></div><p>

The documentation is written in markdown (processed by pandoc). This particular function is documented here: <a href="http://sourceforge.net/p/alleg/allegro/ci/5.1/tree/docs/src/refman/threads.txt">http://sourceforge.net/p/alleg/allegro/ci/5.1/tree/docs/src/refman/threads.txt</a></p><p>It&#39;s just a simple wiki format, so you should be able to create a patch without actually installing pandoc.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Tue, 08 Oct 2013 16:26:29 +0000</pubDate>
	</item>
</rss>
