<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Timer problems</title>
		<link>http://www.allegro.cc/forums/view/566363</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Mon, 13 Feb 2006 04:43:02 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="source-code snippet"><div class="inner"><pre>     <span class="k1">if</span> <span class="k2">(</span>room <span class="k3">=</span><span class="k3">=</span> ROOM_TITLE<span class="k2">)</span><span class="k2">{</span>
        rm_title_Start<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
        <span class="k1">while</span> <span class="k2">(</span>room <span class="k3">=</span><span class="k3">=</span> ROOM_TITLE<span class="k2">)</span><span class="k2">{</span>rm_title_Loop<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span> <span class="k2">}</span>
        rm_title_End<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
     <span class="k2">}</span>
</pre></div></div><p>

Simple code, effectively a class constructor, main loop then destructor, for those who are too lazy to make a class, or just haven&#39;t got round to it yet.</p><p>Aaaaaanyway.</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">void</span> rm_title_Start<span class="k2">(</span><span class="k2">)</span><span class="k2">{</span>
     <a href="http://www.allegro.cc/manual/install_int" target="_blank"><span class="a">install_int</span></a> <span class="k2">(</span>rm_title_callback, <span class="n">1000</span><span class="k2">)</span><span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>
It does that.<br />But then it enters the while loop and pointer errors before any of that functions code is executed.</p><p>Could someone help?<br />I don&#39;t know why it&#39;s doing this.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Miles Lombardi)</author>
		<pubDate>Mon, 13 Feb 2006 04:07:06 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Is rm_title_callback defined correctly? Did you remember to put END_OF_FUNCTION?<br />And did you lock all the used memory correctly with LOCK_FUNCTION and LOCK_VARIABLE?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dennis)</author>
		<pubDate>Mon, 13 Feb 2006 04:25:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I didn&#39;t put end of function, and when i put that it worked.<br />Sorta, it stopped somewhere else XD.<br />What does lock_function do?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Miles Lombardi)</author>
		<pubDate>Mon, 13 Feb 2006 04:30:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I hope you did not just put END_OF_FUNCTION but END_OF_FUNCTION(rm_title_callback).<br />Regarding <a href="http://www.allegro.cc/manual/api/timer-routines/lock_function">LOCK_FUNCTION</a>:
</p><div class="quote_container"><div class="title">install_int_ex said:</div><div class="quote"><p>

In a DOS protected mode environment like DJGPP, memory is virtualised and can be swapped to disk. Due to the non-reentrancy of DOS, if a disk swap occurs inside an interrupt handler the system will die a painful death, so you need to make sure you lock all the memory (both code and data) that is touched inside timer routines. Allegro will lock everything it uses, but you are responsible for locking your handler functions. The macros LOCK_VARIABLE (variable), END_OF_FUNCTION (function_name), END_OF_STATIC_FUNCTION (function_name), and LOCK_FUNCTION (function_name) can be used to simplify this task.
</p></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dennis)</author>
		<pubDate>Mon, 13 Feb 2006 04:43:02 +0000</pubDate>
	</item>
</rss>
