[rkward-cvs] SF.net SVN: rkward:[3176] branches/2010_10_18_backend_restructuring_branch/ rkward/rbackend

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Nov 2 20:37:27 UTC 2010


Revision: 3176
          http://rkward.svn.sourceforge.net/rkward/?rev=3176&view=rev
Author:   tfry
Date:     2010-11-02 20:37:27 +0000 (Tue, 02 Nov 2010)

Log Message:
-----------
Move inRThread() to RThread

Modified Paths:
--------------
    branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rembedinternal.cpp
    branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rembedinternal.h
    branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rinterface.cpp
    branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rinterface.h
    branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rksignalsupport.cpp

Modified: branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rembedinternal.cpp
===================================================================
--- branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rembedinternal.cpp	2010-11-02 20:24:11 UTC (rev 3175)
+++ branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rembedinternal.cpp	2010-11-02 20:37:27 UTC (rev 3176)
@@ -763,8 +763,8 @@
 
 	r_running = true;
 	int argc = 3;
-	char* argv[3] = { "--slave", "--no-save", "--no-restore" };
-	Rf_initialize_R (3, argv);
+	char* argv[3] = { qstrdup ("--slave"), qstrdup ("--no-save"), qstrdup ("--no-restore") };
+	Rf_initialize_R (argc, argv);
 
 	// in R on windows the stack limits detection seems to work out of the box for threads
 #ifndef Q_WS_WIN

Modified: branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rembedinternal.h
===================================================================
--- branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rembedinternal.h	2010-11-02 20:24:11 UTC (rev 3175)
+++ branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rembedinternal.h	2010-11-02 20:37:27 UTC (rev 3176)
@@ -230,6 +230,7 @@
 	bool killed;
 /** A list of symbols that have been assigned new values during the current command */
 	QStringList changed_symbol_names;
+	static bool inRThread () { return (currentThread () == this_pointer); };
 protected:
 /** On pthread systems this is the pthread_id of the backend thread. It is needed to send SIGINT to the R backend */
 	Qt::HANDLE thread_id;

Modified: branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rinterface.cpp
===================================================================
--- branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rinterface.cpp	2010-11-02 20:24:11 UTC (rev 3175)
+++ branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rinterface.cpp	2010-11-02 20:37:27 UTC (rev 3176)
@@ -141,13 +141,9 @@
 	return (RKGlobals::rInterface ()->locked != 0);
 }
 
-bool RInterface::inRThread () {
-	return (QThread::currentThread () == RKGlobals::rInterface ()->r_thread);
-}
-
 void RInterface::tryToDoEmergencySave () {
 	RK_TRACE (RBACKEND);
-	if (!inRThread ()) {
+	if (!RThread::inRThread ()) {
 		RKGlobals::rInterface ()->r_thread->terminate ();
 		RKGlobals::rInterface ()->r_thread->wait (1000);
 	}

Modified: branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rinterface.h
===================================================================
--- branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rinterface.h	2010-11-02 20:24:11 UTC (rev 3175)
+++ branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rinterface.h	2010-11-02 20:37:27 UTC (rev 3176)
@@ -77,7 +77,6 @@
 
 	static bool backendIsLocked ();
 
-	static bool inRThread ();
 	static void tryToDoEmergencySave ();
 private slots:
 /** called periodically to flush output buffer in RThread */

Modified: branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rksignalsupport.cpp
===================================================================
--- branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rksignalsupport.cpp	2010-11-02 20:24:11 UTC (rev 3175)
+++ branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rksignalsupport.cpp	2010-11-02 20:37:27 UTC (rev 3176)
@@ -19,6 +19,7 @@
 
 #include <signal.h>
 
+#include "rembedinternal.h"
 #include "rinterface.h"
 
 #include "../debug.h"
@@ -72,7 +73,7 @@
 		RInterface::tryToDoEmergencySave ();
 
 		// if we are not in the R thread, handling the signal in R does more harm than good.
-		if (RInterface::inRThread ()) {
+		if (RThread::inRThread ()) {
 #ifdef Q_WS_WIN
 			if (r_handler) {
 				r_handler (signum);


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