[rkward-cvs] SF.net SVN: rkward: [2106] branches/KDE4_port/rkward/rbackend

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Oct 22 20:22:52 UTC 2007


Revision: 2106
          http://rkward.svn.sourceforge.net/rkward/?rev=2106&view=rev
Author:   tfry
Date:     2007-10-22 13:22:52 -0700 (Mon, 22 Oct 2007)

Log Message:
-----------
Avoid deadlock in RCommandStack

Modified Paths:
--------------
    branches/KDE4_port/rkward/rbackend/rcommandstack.cpp
    branches/KDE4_port/rkward/rbackend/rcommandstack.h
    branches/KDE4_port/rkward/rbackend/rthread.cpp

Modified: branches/KDE4_port/rkward/rbackend/rcommandstack.cpp
===================================================================
--- branches/KDE4_port/rkward/rbackend/rcommandstack.cpp	2007-10-22 19:41:25 UTC (rev 2105)
+++ branches/KDE4_port/rkward/rbackend/rcommandstack.cpp	2007-10-22 20:22:52 UTC (rev 2106)
@@ -114,17 +114,17 @@
 
 bool RCommandStack::isEmpty () {
 //	RK_TRACE (RBACKEND);
-	return (current_chain->commands.isEmpty () && current_chain->closed);
+	return (commands.isEmpty ());
 }
 
-bool RCommandStack::isBlocked () {
+bool RCommandStack::isActive () {
 //	RK_TRACE (RBACKEND);
-	return ((!current_chain->closed) && (!current_chain->commands.isEmpty ()));
-}
 
-bool RCommandStack::isActive () {
-//	RK_TRACE (RBACKEND);
-	return (!current_chain->commands.isEmpty ());
+	bool ret = !current_chain->commands.isEmpty ();
+	if (!ret) {
+		clearFinishedChains ();
+	}
+	return ret;
 }
 
 //static
@@ -160,7 +160,7 @@
 void RCommandStack::pop () {
 	RK_TRACE (RBACKEND);
 
-	if (!isActive ()) return;
+	if (current_chain->commands.isEmpty ()) return;
 	RCommandBase* popped = current_chain->commands.first ();
 	RK_ASSERT (popped->commandPointer ());
 	RCommandStackModel::getModel ()->aboutToPop (popped->parent);

Modified: branches/KDE4_port/rkward/rbackend/rcommandstack.h
===================================================================
--- branches/KDE4_port/rkward/rbackend/rcommandstack.h	2007-10-22 19:41:25 UTC (rev 2105)
+++ branches/KDE4_port/rkward/rbackend/rcommandstack.h	2007-10-22 20:22:52 UTC (rev 2106)
@@ -42,8 +42,6 @@
 
 /** @returns true, if there are no commands or open chains waiting in this stack */
 	bool isEmpty ();
-/** @returns true, if the currently processed chain is not closed and not empty */
-	bool isBlocked ();
 /** @returns true, if there are commands to be processed in the current chain */
 	bool isActive ();
 

Modified: branches/KDE4_port/rkward/rbackend/rthread.cpp
===================================================================
--- branches/KDE4_port/rkward/rbackend/rthread.cpp	2007-10-22 19:41:25 UTC (rev 2105)
+++ branches/KDE4_port/rkward/rbackend/rthread.cpp	2007-10-22 20:22:52 UTC (rev 2106)
@@ -116,7 +116,7 @@
 		}
 	
 		// while commands are in queue, don't wait
-		while ((!locked) && RCommandStack::regular_stack->isActive () && !locked) {
+		while ((!locked) && RCommandStack::regular_stack->isActive ()) {
 			current_command = RCommandStack::regular_stack->currentCommand ();
 			
 			if (current_command) {
@@ -414,7 +414,7 @@
 		MUTEX_LOCK;
 		processX11Events ();
 		// while commands are in queue, don't wait
-		while (reply_stack->isActive () && !locked) {
+		while ((!locked) && reply_stack->isActive ()) {
 			if (killed) {
 				done = true;
 				break;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list