[rkward-cvs] SF.net SVN: rkward: [1453] trunk/rkward/rkward/rbackend/rembedinternal.cpp

tfry at users.sourceforge.net tfry at users.sourceforge.net
Fri Feb 23 01:12:48 UTC 2007


Revision: 1453
          http://svn.sourceforge.net/rkward/?rev=1453&view=rev
Author:   tfry
Date:     2007-02-22 17:12:47 -0800 (Thu, 22 Feb 2007)

Log Message:
-----------
Properly initialize R stack checking. Hope this compiles on all targets...

Modified Paths:
--------------
    trunk/rkward/rkward/rbackend/rembedinternal.cpp

Modified: trunk/rkward/rkward/rbackend/rembedinternal.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rembedinternal.cpp	2007-02-23 00:25:33 UTC (rev 1452)
+++ trunk/rkward/rkward/rbackend/rembedinternal.cpp	2007-02-23 01:12:47 UTC (rev 1453)
@@ -1,4 +1,3 @@
-
 /***************************************************************************
                           rembedinternal  -  description
                              -------------------
@@ -50,6 +49,7 @@
 //#include <signal.h>
 //#include <unistd.h>
 #include <math.h>
+#include <pthread.h>
 
 #if (R_VERSION > R_Version(2, 2, 9))
 #define R_2_3
@@ -80,7 +80,8 @@
 #ifdef R_2_3
 extern int Rf_initialize_R(int ac, char **av);
 extern void setup_Rmainloop(void); /* in main.c */
-extern unsigned long R_CStackLimit;
+extern uintptr_t R_CStackLimit;
+extern uintptr_t R_CStackStart;
 extern Rboolean R_Interactive;
 #endif
 #ifndef USE_R_REPLDLLDO1
@@ -519,12 +520,21 @@
 bool REmbedInternal::startR (int argc, char** argv) {
 	r_running = true;
 #ifdef R_2_3
+	pthread_attr_t attr;
+	size_t stacksize;
+	void *stackstart;
+	pthread_getattr_np (pthread_self (), &attr);
+	pthread_attr_getstack (&attr, &stackstart, &stacksize);
+
 	Rf_initialize_R (argc, argv);
-	R_CStackLimit = (unsigned long) -1;
+	R_CStackStart = (uintptr_t) stackstart;
+	R_CStackLimit = stacksize;
 	setup_Rmainloop ();
 	RKGlobals::na_double = NA_REAL;
 	R_Interactive = (Rboolean) TRUE;
 	R_ReplDLLinit ();
+
+	pthread_attr_destroy (&attr);
 	return true;
 #else
 	bool ok = (Rf_initEmbeddedR (argc, argv) >= 0);


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