[前][次][番号順一覧][スレッド一覧]

ruby-changes:20355

From: kosaki <ko1@a...>
Date: Mon, 4 Jul 2011 22:27:38 +0900 (JST)
Subject: [ruby-changes:20355] kosaki:r32403 (trunk): * thread_pthread.c (get_stack): For NetBSD/FreeBSD, use

kosaki	2011-07-04 22:27:31 +0900 (Mon, 04 Jul 2011)

  New Revision: 32403

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32403

  Log:
    * thread_pthread.c (get_stack): For NetBSD/FreeBSD, use
      pthread_attr_getstack() if possible. and, remove an assumption
      of stack growing direction.

  Modified files:
    trunk/ChangeLog
    trunk/thread_pthread.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 32402)
+++ ChangeLog	(revision 32403)
@@ -1,3 +1,9 @@
+Mon Jul  4 22:24:46 2011  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* thread_pthread.c (get_stack): For NetBSD/FreeBSD, use
+	  pthread_attr_getstack() if possible. and, remove an assumption
+	  of stack growing direction.
+
 Mon Jul  4 20:42:31 2011  Yusuke Endoh  <mame@t...>
 
 	* ext/coverage/coverage.c: revert r32071.  The commit caused SEGV on
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 32402)
+++ thread_pthread.c	(revision 32403)
@@ -479,9 +479,14 @@
 # elif defined HAVE_PTHREAD_ATTR_GET_NP /* FreeBSD, DragonFly BSD, NetBSD */
     CHECK_ERR(pthread_attr_init(&attr));
     CHECK_ERR(pthread_attr_get_np(pthread_self(), &attr));
+#   ifdef HAVE_PTHREAD_ATTR_GETSTACK
+    CHECK_ERR(pthread_attr_getstack(&attr, addr, size));
+    STACK_DIR_UPPER((void)0, (void)(*addr = (char *)*addr + *size));
+#   else
     CHECK_ERR(pthread_attr_getstackaddr(&attr, addr));
     CHECK_ERR(pthread_attr_getstacksize(&attr, size));
-    *addr = (char *)*addr + *size;
+    STACK_DIR_UPPER((void)0, (void)(*addr = (char *)*addr + *size));
+#   endif
 # else /* MacOS X */
     pthread_t th = pthread_self();
     *addr = pthread_get_stackaddr_np(th);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]