<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wikidot="http://www.wikidot.com/rss-namespace">

	<channel>
		<title>Deadlock found...</title>
		<link>https://www.contraptor.org/forum/t-399704/deadlock-found</link>
		<description>Posts in the discussion thread &quot;Deadlock found...&quot; - Deadlock found in firmware</description>
				<copyright></copyright>
		<lastBuildDate>Fri, 06 Nov 2026 19:37:05 +0000</lastBuildDate>
		
					<item>
				<guid>http://www.contraptor.org/forum/t-399704#post-1279447</guid>
				<title>Re: Deadlock found...</title>
				<link>https://www.contraptor.org/forum/t-399704/deadlock-found#post-1279447</link>
				<description></description>
				<pubDate>Wed, 12 Oct 2011 05:00:51 +0000</pubDate>
				<wikidot:authorName>Albanetc</wikidot:authorName>				<wikidot:authorUserId>381022</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Wow, great catch. Now I see what is responsible for occasional non-responsiveness of the firmware. I was initially blaming it on serial port.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.contraptor.org/forum/t-399704#post-1278465</guid>
				<title>Deadlock found...</title>
				<link>https://www.contraptor.org/forum/t-399704/deadlock-found#post-1278465</link>
				<description></description>
				<pubDate>Mon, 10 Oct 2011 22:15:12 +0000</pubDate>
				<wikidot:authorName>japieb</wikidot:authorName>				<wikidot:authorUserId>1215344</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I've been adapting the firmware to make it usefull for a CNC foam cutter I am going to build.</p> <p>In doing so I found a deadlock situation that also exists in the original firmware:</p> <p>the fragment below can (and did!) result in a deadlock when the G0 command finishes while the G90 command is being handled<br /> G91<br /> G00 X1.0<br /> G90</p> <p>Situation</p> <p>The G00 step is running<br /> The G90 command is received<br /> This line locks the move_queue (process_string.pde)<br /> // Lock move queue while adding new move<br /> 172 move_queue_lock_main = true;<br /> The G0 step finishes<br /> 470 // If finished, start next move<br /> 471 if ( move_finished ) {<br /> 472<br /> 473 // Make sure queue not being modified by<br /> 474 // main routine and then advance<br /> 475 if (!move_queue_lock_main) advance_move_queue();<br /> 476<br /> 477 // If the queue is locked by the main routine, we can't hang about<br /> 478 // and wait for it as this would freeze up the whole system,<br /> 479 // so we just wait until the next time the interrupt routine<br /> 480 // is called and try again<br /> 481 }<br /> The G90 command waits until the move is done (process_string.pde)<br /> 303 while (moving) {} // Do not try and do this while moving</p> <p>Now the move_queue is locked, and moving is still true =&gt; deadlock</p> <p>I fixed this situation by adding a 'move_queue_main_lock=false;' line before all 'while (moving) {}' lines</p> <p>Jaap.</p> 
				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>