[rkward-cvs] SF.net SVN: rkward-code:[4695] trunk/rkward

tfry at users.sf.net tfry at users.sf.net
Fri Apr 12 18:08:30 UTC 2013


Revision: 4695
          http://sourceforge.net/p/rkward/code/4695
Author:   tfry
Date:     2013-04-12 18:08:16 +0000 (Fri, 12 Apr 2013)
Log Message:
-----------
Remove legacy support for compiling RKWard in a single process variant (with R in a secondary thread).
This has been unused since RKWard 0.5.5., and I doubt it was even still functional.

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/rbackend/CMakeLists.txt
    trunk/rkward/rkward/rbackend/rkrbackend.cpp
    trunk/rkward/rkward/rbackend/rkrbackendprotocol_backend.cpp
    trunk/rkward/rkward/rbackend/rkrbackendprotocol_frontend.cpp
    trunk/rkward/rkward/rbackend/rkrbackendprotocol_frontend.h
    trunk/rkward/rkward/rbackend/rkrbackendprotocol_shared.cpp
    trunk/rkward/rkward/rbackend/rkrbackendprotocol_shared.h
    trunk/rkward/rkward/rbackend/rktransmitter.h
    trunk/rkward/rkward/rbackend/rkwarddevice/rkgraphicsdevice_backendtransmitter.cpp
    trunk/rkward/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.cpp

Removed Paths:
-------------
    trunk/rkward/rkward/rbackend/DetectPthreads.cmake
    trunk/rkward/rkward/rbackend/pthread_config.h.cmake
    trunk/rkward/rkward/rbackend/rkpthreadsupport.cpp
    trunk/rkward/rkward/rbackend/rkpthreadsupport.h

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2013-04-12 11:11:53 UTC (rev 4694)
+++ trunk/rkward/ChangeLog	2013-04-12 18:08:16 UTC (rev 4695)
@@ -1,3 +1,4 @@
+- Remove support for compiling RKWard in a single process (threaded) variant. This was not used / tested since RKWard 0.5.5
 - Shortcuts for the "Run ..." actions have been changed for better cross-platform compatibility
 - The script editor's "Run line" and "Run selection" actions have been merged
 - New (experimental) RKWard native on-screen device (RK())

Modified: trunk/rkward/rkward/rbackend/CMakeLists.txt
===================================================================
--- trunk/rkward/rkward/rbackend/CMakeLists.txt	2013-04-12 11:11:53 UTC (rev 4694)
+++ trunk/rkward/rkward/rbackend/CMakeLists.txt	2013-04-12 18:08:16 UTC (rev 4695)
@@ -1,13 +1,13 @@
 INCLUDE(FindR.cmake)
 IF(NOT WIN32)
+	# for pthread_at_fork
 	FIND_PACKAGE(Threads)
-	INCLUDE(DetectPthreads.cmake)
 ENDIF(NOT WIN32)
 
 ADD_SUBDIRECTORY( rpackages )
 ADD_SUBDIRECTORY( rkwarddevice )
 
-INCLUDE_DIRECTORIES( ${R_INCLUDEDIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${KDE4_INCLUDE_DIR} ${QT_INCLUDES}  )
+INCLUDE_DIRECTORIES( ${R_INCLUDEDIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} )
 
 SET (
 	rbackend_shared_SRCS
@@ -18,7 +18,6 @@
 SET (
 	rbackend_backend_SRCS
 	rkrbackend.cpp
-	rkpthreadsupport.cpp
 	rksignalsupport.cpp
 	rklocalesupport.cpp
 	rkrsupport.cpp
@@ -36,50 +35,35 @@
 	rksessionvars.cpp
 )
 
-SET(RBACKEND_SPLIT 1)
-IF(RBACKEND_SPLIT)
-	SET (
-		rbackend_FRONTEND_SRCS
-		${rbackend_frontend_SRCS}
-		${rbackend_shared_SRCS}
-		rkfrontendtransmitter.cpp
-		rktransmitter.cpp
-	)
-	QT4_AUTOMOC(${rbackend_FRONTEND_SRCS})
-	ADD_LIBRARY(rbackend STATIC ${rbackend_FRONTEND_SRCS})
-	TARGET_LINK_LIBRARIES(rbackend rkgraphicsdevice.frontend ${CMAKE_THREAD_LIBS_INIT})
+SET (
+	rbackend_FRONTEND_SRCS
+	${rbackend_frontend_SRCS}
+	${rbackend_shared_SRCS}
+	rkfrontendtransmitter.cpp
+	rktransmitter.cpp
+)
+QT4_AUTOMOC(${rbackend_FRONTEND_SRCS})
+ADD_LIBRARY(rbackend STATIC ${rbackend_FRONTEND_SRCS})
+TARGET_LINK_LIBRARIES(rbackend rkgraphicsdevice.frontend)
 
-	SET (
-		rbackend_BACKEND_SRCS
-		${rbackend_backend_SRCS}
-		${rbackend_shared_SRCS}
-		rkbackendtransmitter.cpp
-		rktransmitter.cpp
-	)
-	QT4_AUTOMOC(${rbackend_BACKEND_SRCS})
-	ADD_DEFINITIONS (-DRKWARD_SPLIT_PROCESS)
-	LINK_DIRECTORIES(${R_SHAREDLIBDIR})
-	ADD_EXECUTABLE(rkward.rbackend ${rbackend_BACKEND_SRCS})
-	FIND_PACKAGE(Gettext REQUIRED)
-	TARGET_LINK_LIBRARIES(rkward.rbackend rkgraphicsdevice.backend ${R_USED_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${QT_QTNETWORK_LIBRARY} ${QT_QTCORE_LIBRARY} ${GETTEXT_LIBRARIES})
+SET (
+	rbackend_BACKEND_SRCS
+	${rbackend_backend_SRCS}
+	${rbackend_shared_SRCS}
+	rkbackendtransmitter.cpp
+	rktransmitter.cpp
+)
+QT4_AUTOMOC(${rbackend_BACKEND_SRCS})
+ADD_DEFINITIONS (-DRKWARD_SPLIT_PROCESS)
+LINK_DIRECTORIES(${R_SHAREDLIBDIR})
+ADD_EXECUTABLE(rkward.rbackend ${rbackend_BACKEND_SRCS})
+FIND_PACKAGE(Gettext REQUIRED)
+TARGET_LINK_LIBRARIES(rkward.rbackend rkgraphicsdevice.backend ${R_USED_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${QT_QTNETWORK_LIBRARY} ${QT_QTCORE_LIBRARY} ${GETTEXT_LIBRARIES} )
 
-	IF(WIN32)
-		# on Widows, we install to the rbackend subdirectory, because 1) LIBEXEC_INSTALL_DIR == BIN_INSTALL_DIR and 2) we don't want the backend to pick up
-		# all the KDE library versions, first, when loading DLLs
-		INSTALL(TARGETS rkward.rbackend DESTINATION ${BIN_INSTALL_DIR}/rbackend)
-	ELSE(WIN32)
-			INSTALL(TARGETS rkward.rbackend DESTINATION ${RKWARD_FRONTEND_LOCATION})
-	ENDIF(WIN32)
-ELSE(RBACKEND_SPLIT)
-	SET (
-		rbackend_ALL_SRCS
-		${rbackend_frontend_SRCS}
-		${rbackend_shared_SRCS}
-		${rbackend_backend_SRCS}
-	)
-
-	QT4_AUTOMOC(${rbackend_ALL_SRCS})
-	LINK_DIRECTORIES(${R_SHAREDLIBDIR})
-	ADD_LIBRARY(rbackend STATIC ${rbackend_ALL_SRCS})
-	TARGET_LINK_LIBRARIES(rbackend rkgraphicsdevice.backend rkgraphicsdevice.frontend ${R_USED_LIBS} ${CMAKE_THREAD_LIBS_INIT})
-ENDIF(RBACKEND_SPLIT)
+IF(WIN32)
+	# on Widows, we install to the rbackend subdirectory, because 1) LIBEXEC_INSTALL_DIR == BIN_INSTALL_DIR and 2) we don't want the backend to pick up
+	# all the KDE library versions, first, when loading DLLs
+	INSTALL(TARGETS rkward.rbackend DESTINATION ${BIN_INSTALL_DIR}/rbackend)
+ELSE(WIN32)
+		INSTALL(TARGETS rkward.rbackend DESTINATION ${RKWARD_FRONTEND_LOCATION})
+ENDIF(WIN32)

Deleted: trunk/rkward/rkward/rbackend/DetectPthreads.cmake
===================================================================
--- trunk/rkward/rkward/rbackend/DetectPthreads.cmake	2013-04-12 11:11:53 UTC (rev 4694)
+++ trunk/rkward/rkward/rbackend/DetectPthreads.cmake	2013-04-12 18:08:16 UTC (rev 4695)
@@ -1,12 +0,0 @@
-INCLUDE(CheckIncludeFile)
-INCLUDE(CheckFunctionExists)
-
-CHECK_INCLUDE_FILE(pthread_np.h HAVE_PTHREAD_NP_H)
-
-SET (CMAKE_REQUIRED_FLAGS ${CMAKE_THREAD_LIBS_INIT})
-CHECK_FUNCTION_EXISTS (pthread_getattr_np HAVE_PTHREAD_GETATTR_NP)
-CHECK_FUNCTION_EXISTS (pthread_attr_get_np HAVE_PTHREAD_ATTR_GET_NP)
-CHECK_FUNCTION_EXISTS (pthread_get_stacksize_np HAVE_PTHREAD_GET_STACKSIZE_NP)
-CHECK_FUNCTION_EXISTS (pthread_get_stackaddr_np HAVE_PTHREAD_GET_STACKADDR_NP)
-
-CONFIGURE_FILE(pthread_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/pthread_config.h)

Deleted: trunk/rkward/rkward/rbackend/pthread_config.h.cmake
===================================================================
--- trunk/rkward/rkward/rbackend/pthread_config.h.cmake	2013-04-12 11:11:53 UTC (rev 4694)
+++ trunk/rkward/rkward/rbackend/pthread_config.h.cmake	2013-04-12 18:08:16 UTC (rev 4695)
@@ -1,5 +0,0 @@
-#cmakedefine HAVE_PTHREAD_NP_H
-#cmakedefine HAVE_PTHREAD_GETATTR_NP
-#cmakedefine HAVE_PTHREAD_ATTR_GET_NP
-#cmakedefine HAVE_PTHREAD_GET_STACKSIZE_NP
-#cmakedefine HAVE_PTHREAD_GET_STACKADDR_NP

Deleted: trunk/rkward/rkward/rbackend/rkpthreadsupport.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rkpthreadsupport.cpp	2013-04-12 11:11:53 UTC (rev 4694)
+++ trunk/rkward/rkward/rbackend/rkpthreadsupport.cpp	2013-04-12 18:08:16 UTC (rev 4695)
@@ -1,95 +0,0 @@
-/***************************************************************************
-                          rkpthreadsupport  -  description
-                             -------------------
-    begin                : Fri Feb 23 2007
-    copyright            : (C) 2007, 2009 by Thomas Friedrichsmeier
-    email                : tfry at users.sourceforge.net
- ***************************************************************************/
-
-/***************************************************************************
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- ***************************************************************************/
-
-#include "rkpthreadsupport.h"
-
-#include <qstring.h>
-#include "../debug.h"
-
-#ifdef Q_WS_WIN
-#	include <windows.h>
-#	include <stdint.h>	// for uintptr_t
-#else
-#	include <pthread.h>
-#	include "pthread_config.h"
-#endif
-#ifdef HAVE_PTHREAD_NP_H
-#	include <pthread_np.h>
-#endif
-
-/* Much of this code is borrowed from WINE (http://www.winehq.org) */
-
-void RKGetCurrentThreadStackLimits (size_t *size, void **base, char *reference) {
-	int direction;
-#ifdef HAVE_PTHREAD_GETATTR_NP
-	pthread_attr_t attr;
-	pthread_getattr_np (pthread_self (), &attr);
-	pthread_attr_getstack (&attr, base, size);
-	pthread_attr_destroy (&attr);
-#elif defined(HAVE_PTHREAD_ATTR_GET_NP)
-	pthread_attr_t attr;
-	pthread_attr_init (&attr);
-	pthread_attr_get_np (pthread_self (), &attr);
-	pthread_attr_getstack (&attr, base, size);
-	pthread_attr_destroy (&attr);
-#elif defined(HAVE_PTHREAD_GET_STACKSIZE_NP) && defined(HAVE_PTHREAD_GET_STACKADDR_NP)
-	*size = pthread_get_stacksize_np (pthread_self ());
-	*base = pthread_get_stackaddr_np (pthread_self ());
-#elif defined Q_WS_WIN
-// This section (up to #endif) copied almost verbatim from R src/gnuwin32/system.c:
-/*  Copyright (C) 1995, 1996  Robert Gentleman and Ross Ihaka
- *  Copyright (C) 1997--2007  Robert Gentleman, Ross Ihaka and the
- *                            R Development Core Team */
-	{
-		MEMORY_BASIC_INFORMATION buf;
-		uintptr_t bottom, top;
-		
-		VirtualQuery(reference, &buf, sizeof(buf));
-		bottom = (uintptr_t) buf.AllocationBase;
-		top = (uintptr_t) buf.BaseAddress + buf.RegionSize;
-
-		*base = (void*) top;
-		*size = (size_t) (top - bottom);
-	}
-#else
-#	warning Cannot determine the stack limits of a pthread on this system
-#	warning R C stack checking will be disabled
-	*base = reference;
-	*size = (unsigned long) -1;
-	return;
-#endif
-	// in which direction does the stack grow?
-	{
-		char dummy2;
-		direction = reference > (&dummy2) ? 1 : -1;
-	}
-
-	// in which direction does the stack base lie?
-	int base_direction = (*base) > reference ? 1 : -1;
-
-	// switch base / top, if necessary
-	if (base_direction != direction) {
-		*base = ((char *) *base) + (direction * ((unsigned long) *size));
-	}
-
-	// sanity check, as on some systems the stack direction is mis-detected somehow.
-	long usage = direction * ((unsigned long) (*base) - (unsigned long) (reference));
-	if ((usage < 0) || (unsigned long) usage > (unsigned long) (*size)) {
-		RK_DEBUG (RBACKEND, DL_WARNING, "Stack boundaries detection produced bad results. Disabling stack checking.");
-		*size = (unsigned long) -1;
-	}
-}

Deleted: trunk/rkward/rkward/rbackend/rkpthreadsupport.h
===================================================================
--- trunk/rkward/rkward/rbackend/rkpthreadsupport.h	2013-04-12 11:11:53 UTC (rev 4694)
+++ trunk/rkward/rkward/rbackend/rkpthreadsupport.h	2013-04-12 18:08:16 UTC (rev 4695)
@@ -1,26 +0,0 @@
-/***************************************************************************
-                          rkpthreadsupport  -  description
-                             -------------------
-    begin                : Fri Feb 23 2007
-    copyright            : (C) 2007 by Thomas Friedrichsmeier
-    email                : tfry at users.sourceforge.net
- ***************************************************************************/
-
-/***************************************************************************
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- ***************************************************************************/
-
-#ifndef RKPTHREADSUPPORT_H
-#define RKPTHREADSUPPORT_H
-
-#include <stddef.h>
-
-/** Try different ways to get the stack limits of the currently running thread */
-void RKGetCurrentThreadStackLimits (size_t *size, void **base, char *reference);
-
-#endif

Modified: trunk/rkward/rkward/rbackend/rkrbackend.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rkrbackend.cpp	2013-04-12 11:11:53 UTC (rev 4694)
+++ trunk/rkward/rkward/rbackend/rkrbackend.cpp	2013-04-12 18:08:16 UTC (rev 4695)
@@ -47,7 +47,6 @@
 #include "rkrsupport.h"
 #include "rkstructuregetter.h"
 #include "rklocalesupport.h"
-#include "rkpthreadsupport.h"
 #include "rksignalsupport.h"
 #include "../misc/rkcommonfunctions.h"
 
@@ -100,7 +99,7 @@
 #endif
 
 ///// i18n
-#if (defined ENABLE_NLS) && (!defined RKWARD_THREADED)		// ENABLE_NLS is from Rconfig.h
+#if (defined ENABLE_NLS)		// ENABLE_NLS is from Rconfig.h
 #	include <libintl.h>
 #	define RK_MSG_DOMAIN "rkward"
 	// define i18n to be compatible with the easiest usage in KDE
@@ -1012,18 +1011,6 @@
 	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
-	{
-		char dummy;
-		size_t stacksize;
-		void *stackstart;
-		RKGetCurrentThreadStackLimits (&stacksize, &stackstart, &dummy);
-		R_CStackStart = (uintptr_t) stackstart;
-		R_CStackLimit = stacksize;
-	}
-#endif
-
 #ifdef Q_WS_WIN
 	R_set_command_line_arguments(argc, argv);
 	FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE));

Modified: trunk/rkward/rkward/rbackend/rkrbackendprotocol_backend.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rkrbackendprotocol_backend.cpp	2013-04-12 11:11:53 UTC (rev 4694)
+++ trunk/rkward/rkward/rbackend/rkrbackendprotocol_backend.cpp	2013-04-12 18:08:16 UTC (rev 4695)
@@ -24,65 +24,16 @@
 #include <QCoreApplication>
 #include <QThread>
 
-#ifdef RKWARD_THREADED
-#	include "rkrbackendprotocol_frontend.h"
-#else
-#	include <QLocalSocket>
-#	include <QMutex>
-#	include "rktransmitter.h"
-#	include <stdio.h>
-#endif
+#include <QLocalSocket>
+#include <QMutex>
+#include "rktransmitter.h"
+#include <stdio.h>
 
-#ifdef RKWARD_THREADED
-	class RKRBackendThread : public QThread {
-	public:
-		RKRBackendThread () {
-#	ifdef Q_WS_WIN
-			// we hope that on other platforms the default is reasonable
-			setStackSize (0xa00000);	// 10MB as recommended by r_exts-manual
-#	endif
-			instance = this;
-		};
-		~RKRBackendThread () {};
+#include "rkbackendtransmitter.h"
+#include <QUuid>		// mis-used as a random-string generator
+#include <QTemporaryFile>
+#include <QDir>
 
-		// called form the *other* thread, only
-		void exitThread () {
-			RK_TRACE (RBACKEND);
-			if (isRunning ()) {
-				RK_DEBUG (RBACKEND, DL_INFO, "Waiting for R thread to finish up...");
-				RKRBackendProtocolBackend::interruptProcessing ();
-				RKRBackend::this_pointer->kill ();
-				wait (1000);
-				if (isRunning ()) {
-					RK_DEBUG (RBACKEND, DL_WARNING, "Backend thread is still running. It will be killed, now.");
-					terminate ();
-					yieldCurrentThread ();
-					RK_ASSERT (false);
-				}
-			}
-		};
-
-		void publicmsleep (int delay) { msleep (delay); };
-
-		void run () {
-			RK_TRACE (RBACKEND);
-#	ifndef Q_WS_WIN
-			RKRBackendProtocolBackend::instance ()->r_thread_id = currentThreadId ();
-#	endif
-			RKRBackend::this_pointer->run ();
-		}
-
-		/** 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;
-		static RKRBackendThread* instance;
-	};
-	RKRBackendThread* RKRBackendThread::instance = 0;
-#else
-#	include "rkbackendtransmitter.h"
-#	include <QUuid>		// mis-used as a random-string generator
-#	include <QTemporaryFile>
-#	include <QDir>
-
 	extern "C" void RK_setupGettext (const char*);
 	int RK_Debug_Level = 2;
 	int RK_Debug_Flags = DEBUG_ALL;
@@ -164,7 +115,6 @@
 
 		if (!RKRBackend::this_pointer->isKilled ()) RKRBackend::tryToDoEmergencySave ();
 	}
-#endif
 
 RKRBackendProtocolBackend* RKRBackendProtocolBackend::_instance = 0;
 RKRBackendProtocolBackend::RKRBackendProtocolBackend (const QString &storage_dir, const QString &_rkd_server_name) {
@@ -172,15 +122,9 @@
 
 	_instance = this;
 	new RKRBackend ();
-#ifdef RKWARD_THREADED
-	r_thread = new RKRBackendThread ();
-	// NOTE: r_thread_id is obtained from within the thread
-	RKRBackendThread::instance->start ();
-#else
 	r_thread = QThread::currentThread ();	// R thread == main thread
-#	ifndef Q_WS_WIN
+#ifndef Q_WS_WIN
 	r_thread_id = QThread::currentThreadId ();
-#	endif
 #endif
 	data_dir = storage_dir;
 	rkd_server_name = _rkd_server_name;
@@ -188,11 +132,6 @@
 
 RKRBackendProtocolBackend::~RKRBackendProtocolBackend () {
 	RK_TRACE (RBACKEND);
-
-#ifdef RKWARD_THREADED
-	RKRBackendThread::instance->exitThread ();
-	delete RKRBackendThread::instance;
-#endif
 }
 
 void RKRBackendProtocolBackend::sendRequest (RBackendRequest *_request) {
@@ -204,12 +143,8 @@
 		_request->done = true;				// for aesthetics
 	}
 	RKRBackendEvent* event = new RKRBackendEvent (request);
-#ifdef RKWARD_THREADED
-	qApp->postEvent (RKRBackendProtocolFrontend::instance (), event);
-#else
 	RK_ASSERT (request->type != RBackendRequest::Output);
 	qApp->postEvent (RKRBackendTransmitter::instance (), event);
-#endif
 }
 
 bool RKRBackendProtocolBackend::inRThread () {
@@ -217,17 +152,9 @@
 }
 
 void RKRBackendProtocolBackend::msleep (int delay) {
-#ifdef RKWARD_THREADED
-	RKRBackendThread::instance->publicmsleep (delay);
-#else
 	static_cast<RKRBackendTransmitter*> (RKRBackendTransmitter::instance ())->publicmsleep (delay);
-#endif
 }
 
 QString RKRBackendProtocolBackend::backendDebugFile () {
-#ifdef RKWARD_THREADED
-	return (QString ());
-#else
 	return RK_Debug_File->fileName ();
-#endif
 }

Modified: trunk/rkward/rkward/rbackend/rkrbackendprotocol_frontend.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rkrbackendprotocol_frontend.cpp	2013-04-12 11:11:53 UTC (rev 4694)
+++ trunk/rkward/rkward/rbackend/rkrbackendprotocol_frontend.cpp	2013-04-12 18:08:16 UTC (rev 4695)
@@ -21,19 +21,11 @@
 
 #include <QThread>
 
-#ifdef RKWARD_THREADED
-#	include "rkrbackend.h"
-#	include "rkrbackendprotocol_backend.h"
-#else
-#	include "rkfrontendtransmitter.h"
-#	include <QCoreApplication>
-#endif
+#include "rkfrontendtransmitter.h"
+#include <QCoreApplication>
 
 #include "../debug.h"
 
-#ifndef RKWARD_THREADED
-#endif
-
 RKRBackendProtocolFrontend* RKRBackendProtocolFrontend::_instance = 0;
 RKRBackendProtocolFrontend::RKRBackendProtocolFrontend (RInterface* parent) : QObject (parent) {
 	RK_TRACE (RBACKEND);
@@ -47,23 +39,15 @@
 	RK_TRACE (RBACKEND);
 
 	terminateBackend ();
-#ifdef RKWARD_THREADED
-	delete RKRBackendProtocolBackend::instance ();
-#else
 	RKFrontendTransmitter::instance ()->quit ();
 	RKFrontendTransmitter::instance ()->wait (1000);
 	delete RKFrontendTransmitter::instance ();
-#endif
 }
 
 void RKRBackendProtocolFrontend::setupBackend () {
 	RK_TRACE (RBACKEND);
 
-#ifdef RKWARD_THREADED
-	new RKRBackendProtocolBackend ();
-#else
 	new RKFrontendTransmitter ();
-#endif
 }
 
 void RKRBackendProtocolFrontend::setRequestCompleted (RBackendRequest *request) {
@@ -73,42 +57,28 @@
 	request->completed ();
 	if (!sync) return;
 
-#ifndef RKWARD_THREADED
 	RKRBackendEvent* ev = new RKRBackendEvent (request);
 	qApp->postEvent (RKFrontendTransmitter::instance (), ev);
-#endif
+
 	QThread::yieldCurrentThread ();
 }
 
 ROutputList RKRBackendProtocolFrontend::flushOutput (bool force) {
-#ifdef RKWARD_THREADED
-	return (RKRBackend::this_pointer->flushOutput (force));
-#else
 	return static_cast<RKFrontendTransmitter*> (RKFrontendTransmitter::instance ())->flushOutput (force);
-#endif
 }
 
 void RKRBackendProtocolFrontend::interruptCommand (int command_id) {
 	RK_TRACE (RBACKEND);
 
-#ifdef RKWARD_THREADED
-	RK_ASSERT (!RKRBackendProtocolBackend::inRThread ());
-	RKRBackendProtocolBackend::interruptCommand (command_id);
-#else
 	RBackendRequest *req = new RBackendRequest (false, RBackendRequest::Interrupt);
 	req->params.insert ("commandid", QVariant (command_id));
 	qApp->postEvent (RKFrontendTransmitter::instance (), new RKRBackendEvent (req));
-#endif
 }
 
 void RKRBackendProtocolFrontend::terminateBackend () {
 	RK_TRACE (RBACKEND);
 
-#ifdef RKWARD_THREADED
-	RKRBackend::this_pointer->kill ();
-#else
 	// Backend process will terminate automatically, when the transmitter dies
-#endif
 }
 
 void RKRBackendProtocolFrontend::customEvent (QEvent *e) {
@@ -120,4 +90,3 @@
 		return;
 	}
 }
-

Modified: trunk/rkward/rkward/rbackend/rkrbackendprotocol_frontend.h
===================================================================
--- trunk/rkward/rkward/rbackend/rkrbackendprotocol_frontend.h	2013-04-12 11:11:53 UTC (rev 4694)
+++ trunk/rkward/rkward/rbackend/rkrbackendprotocol_frontend.h	2013-04-12 18:08:16 UTC (rev 4695)
@@ -39,9 +39,7 @@
 protected:
 /** needed to handle the QEvents, the R thread is sending (notifications on what's happening in the backend thread) */
 	void customEvent (QEvent *e);
-#ifndef RKWARD_THREADED
 	QThread* main_thread;
-#endif
 private:
 	static RKRBackendProtocolFrontend* _instance;
 	RInterface *frontend;

Modified: trunk/rkward/rkward/rbackend/rkrbackendprotocol_shared.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rkrbackendprotocol_shared.cpp	2013-04-12 11:11:53 UTC (rev 4694)
+++ trunk/rkward/rkward/rbackend/rkrbackendprotocol_shared.cpp	2013-04-12 18:08:16 UTC (rev 4695)
@@ -52,7 +52,6 @@
 	delete output;
 };
 
-#ifndef RKWARD_THREADED
 void RBackendRequest::mergeReply (RBackendRequest *reply) {
 	RK_TRACE (RBACKEND);
 
@@ -62,7 +61,6 @@
 	reply->command = 0;
 	reply->output = 0;
 }
-#endif
 
 RBackendRequest* RBackendRequest::duplicate () {
 	RK_TRACE (RBACKEND);

Modified: trunk/rkward/rkward/rbackend/rkrbackendprotocol_shared.h
===================================================================
--- trunk/rkward/rkward/rbackend/rkrbackendprotocol_shared.h	2013-04-12 11:11:53 UTC (rev 4694)
+++ trunk/rkward/rkward/rbackend/rkrbackendprotocol_shared.h	2013-04-12 18:08:16 UTC (rev 4695)
@@ -18,10 +18,6 @@
 #ifndef RKRBACKENDPROTOCOL_SHARED_H
 #define RKRBACKENDPROTOCOL_SHARED_H
 
-#ifndef RKWARD_SPLIT_PROCESS
-#	define RKWARD_THREADED
-#endif
-
 #include <QVariantMap>
 #include <QMutex>
 #include "rcommand.h"
@@ -46,10 +42,8 @@
 		SetParamsFromBackend,
 		Debugger,
 		CommandLineIn,	/**< The next line of the current user command has been submitted in the backend. */
-#ifndef RKWARD_THREADED
 		Output,		/**< A piece of output. Note: If the backend runs in a single process, output is handled in a pull fashion, instead of using requests. */
 		Interrupt,	/**< Interrupt evaluation. This request type originates in the frontend, not the backend (the only one so far). */
-#endif
 		OutputStartedNotification, /**< Only used in the frontend: Notification that a new bit of output has arrived. Used to trigger flushing after a timeout. */
 		OtherRequest		/**< Any other type of request. Note: which requests are in the enum, and which are not has mostly historical reasons. @see params */
 	};
@@ -80,10 +74,8 @@
 	QVariantMap params;
 /** NOTE: only used for separate process backend. See RCallbackType::Output */
 	ROutputList *output;
-#ifndef RKWARD_THREADED
 /** NOTE: this does @em not copy merge the "done" flag. Do that manually, @em after merging (and don't touch the request from the transmitter thread, after that). */
 	void mergeReply (RBackendRequest *reply);
-#endif
 protected:
 	friend class RKRBackendProtocolFrontend;
 	friend class RKRBackendProtocolBackend;

Modified: trunk/rkward/rkward/rbackend/rktransmitter.h
===================================================================
--- trunk/rkward/rkward/rbackend/rktransmitter.h	2013-04-12 11:11:53 UTC (rev 4694)
+++ trunk/rkward/rkward/rbackend/rktransmitter.h	2013-04-12 18:08:16 UTC (rev 4695)
@@ -23,10 +23,6 @@
 #include <QThread>
 #include <QByteArray>
 
-#ifndef RKWARD_SPLIT_PROCESS
-#	error This should only be compiled for split process backends.
-#endif
-
 /** functions for serialization / unserialization of communication between backend and frontend.
 NOTE: This could really be a namespace, instead of a class, but "friending" a class is simply easier... */
 class RKRBackendSerializer {

Modified: trunk/rkward/rkward/rbackend/rkwarddevice/rkgraphicsdevice_backendtransmitter.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rkwarddevice/rkgraphicsdevice_backendtransmitter.cpp	2013-04-12 11:11:53 UTC (rev 4694)
+++ trunk/rkward/rkward/rbackend/rkwarddevice/rkgraphicsdevice_backendtransmitter.cpp	2013-04-12 18:08:16 UTC (rev 4695)
@@ -19,7 +19,6 @@
 
 #include <QLocalSocket>
 #include "../rkrbackendprotocol_backend.h"
-#define RKWARD_SPLIT_PROCESS 1
 #include "../rkbackendtransmitter.h"
 
 #include "../../debug.h"

Modified: trunk/rkward/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.cpp	2013-04-12 11:11:53 UTC (rev 4694)
+++ trunk/rkward/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.cpp	2013-04-12 18:08:16 UTC (rev 4695)
@@ -28,9 +28,6 @@
 #include <QApplication>
 #include <QDesktopWidget>
 
-// NOTE: This is but the latest nail in the coffin of the single process variant of RKWard.
-// *IF* the RKWard Graphics Device works out as hoped, the single process variant can finally be ditched for good.
-#define RKWARD_SPLIT_PROCESS 1
 #include "../rkfrontendtransmitter.h"
 #include "../../windows/rkworkplace.h"
 #include "rkgraphicsdevice.h"





More information about the rkward-tracker mailing list