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

ruby-changes:31615

From: akr <ko1@a...>
Date: Sun, 17 Nov 2013 01:49:45 +0900 (JST)
Subject: [ruby-changes:31615] akr:r43694 (trunk): * thread_pthread.c (rb_thread_create_timer_thread): Show error

akr	2013-11-17 01:49:39 +0900 (Sun, 17 Nov 2013)

  New Revision: 43694

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

  Log:
    * thread_pthread.c (rb_thread_create_timer_thread): Show error
      message instead of error number.
    
    * cont.c (fiber_machine_stack_alloc): Ditto.

  Modified files:
    trunk/ChangeLog
    trunk/cont.c
    trunk/thread_pthread.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43693)
+++ ChangeLog	(revision 43694)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Nov 17 01:43:33 2013  Tanaka Akira  <akr@f...>
+
+	* thread_pthread.c (rb_thread_create_timer_thread): Show error
+	  message instead of error number.
+
+	* cont.c (fiber_machine_stack_alloc): Ditto.
+
 Sat Nov 16 18:28:08 2013  Kouhei Sutou  <kou@c...>
 
 	* lib/rexml/parsers/ultralightparser.rb
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 43693)
+++ thread_pthread.c	(revision 43694)
@@ -1470,7 +1470,7 @@ rb_thread_create_timer_thread(void) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1470
 
 	err = pthread_attr_init(&attr);
 	if (err != 0) {
-	    fprintf(stderr, "[FATAL] Failed to initialize pthread attr(errno: %d)\n", err);
+	    fprintf(stderr, "[FATAL] Failed to initialize pthread attr: %s\n", strerror(err));
 	    exit(EXIT_FAILURE);
         }
 # ifdef PTHREAD_STACK_MIN
@@ -1503,7 +1503,7 @@ rb_thread_create_timer_thread(void) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1503
 	err = pthread_create(&timer_thread_id, NULL, thread_timer, &GET_VM()->gvl);
 #endif
 	if (err != 0) {
-	    fprintf(stderr, "[FATAL] Failed to create timer thread (errno: %d)\n", err);
+	    fprintf(stderr, "[FATAL] Failed to create timer thread: %s\n", strerror(err));
 	    exit(EXIT_FAILURE);
 	}
 #ifdef HAVE_PTHREAD_ATTR_INIT
Index: cont.c
===================================================================
--- cont.c	(revision 43693)
+++ cont.c	(revision 43694)
@@ -625,7 +625,7 @@ fiber_machine_stack_alloc(size_t size) https://github.com/ruby/ruby/blob/trunk/cont.c#L625
 	errno = 0;
 	ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, FIBER_STACK_FLAGS, -1, 0);
 	if (ptr == MAP_FAILED) {
-	    rb_raise(rb_eFiberError, "can't alloc machine stack to fiber errno: %d", errno);
+	    rb_raise(rb_eFiberError, "can't alloc machine stack to fiber: %s", strerror(errno));
 	}
 
 	/* guard page setup */

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

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