<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Allegro and multitasking</title>
		<link>http://www.allegro.cc/forums/view/561126</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Mon, 23 Jan 2006 17:47:11 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I wrote a game using Allegro for graphics and libnet for networking and it seems to have a serious problem with multitasking. When I run in Windows (98) two instances of the program, only the one on foreground seems to work. When both windows are &#39;unfocused&#39;, they work, but they&#39;re both updating screen very slowly.<br />When I run two windows in Linux, they work and communicate without lag, but they&#39;re still slow. The graphics are very simple, but it looks like my program is always eating 100% of CPU time.<br />What can I do to fix the problem?</p><p>(I&#39;m setting switch_mode to BACKGROUND/BACKAMNESIA in Allegro, and I put rest(0) in the main game loop, like the manual advises).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (pav0)</author>
		<pubDate>Mon, 23 Jan 2006 02:49:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Allegro always tries to use 100% of CPU. You need to call <i>rest(1);</i> inside your main loop to get a lower CPU usage. As for foreground only working, see <span class="source-code"><a href="http://www.allegro.cc/manual/set_display_switch_mode" target="_blank"><span class="a">set_display_switch_mode</span></a></span>.</p><p>(Edited: It is <i>rest(1)</i>, <i>rest(0)</i> yields CPU, which is something you don&#39;t want. As for SWITCH, set it <a href="http://www.allegro.cc/forums/thread/387270#target">AFTER</a> setting the graphics mode, not before. Also, see <a href="http://www.allegro.cc/forums/thread/387353#target">Kitty Cat</a> comment).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ReyBrujo)</author>
		<pubDate>Mon, 23 Jan 2006 03:18:39 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>rest(0) is saying to the scheduler, i&#39;ll rest if you have something else to do, else i&#39;ll continue.</p><p>rest(1) says to teh scheduler,  i <b>will</b> rest 1 millisecond.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (A J)</author>
		<pubDate>Mon, 23 Jan 2006 03:39:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I changed the call to rest(1) and now it works well. Thanks for advice.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (pav0)</author>
		<pubDate>Mon, 23 Jan 2006 17:47:11 +0000</pubDate>
	</item>
</rss>
