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

ruby-changes:13925

From: nobu <ko1@a...>
Date: Thu, 12 Nov 2009 14:37:30 +0900 (JST)
Subject: [ruby-changes:13925] Ruby:r25729 (mvm): * merged from trunk r25718:25728.

nobu	2009-11-12 14:37:12 +0900 (Thu, 12 Nov 2009)

  New Revision: 25729

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

  Log:
    * merged from trunk r25718:25728.

  Modified files:
    branches/mvm/.document
    branches/mvm/.merged-trunk-revision
    branches/mvm/ChangeLog
    branches/mvm/enumerator.c
    branches/mvm/lib/tempfile.rb
    branches/mvm/lib/tmpdir.rb
    branches/mvm/test/test_tempfile.rb
    branches/mvm/thread.c
    branches/mvm/thread_pthread.c
    branches/mvm/thread_win32.c
    branches/mvm/version.h

Index: mvm/thread_win32.c
===================================================================
--- mvm/thread_win32.c	(revision 25728)
+++ mvm/thread_win32.c	(revision 25729)
@@ -187,9 +187,11 @@
 
 #ifdef HAVE__BEGINTHREADEX
 #define start_thread (HANDLE)_beginthreadex
+#define thread_errno errno
 typedef unsigned long (_stdcall *w32_thread_start_func)(void*);
 #else
 #define start_thread CreateThread
+#define thread_errno rb_w32_map_errno(GetLastError())
 typedef LPTHREAD_START_ROUTINE w32_thread_start_func;
 #endif
 
@@ -511,8 +513,7 @@
     th->thread_id = w32_create_thread(stack_size, thread_start_func_1, th);
 
     if ((th->thread_id) == 0) {
-	st_delete_wrap(th->vm->living_threads, th->self);
-	rb_raise(rb_eThreadError, "can't create Thread (%d)", errno);
+	return thread_errno;
     }
 
     w32_resume_thread(th->thread_id);
Index: mvm/ChangeLog
===================================================================
--- mvm/ChangeLog	(revision 25728)
+++ mvm/ChangeLog	(revision 25729)
@@ -1,3 +1,33 @@
+Thu Nov 12 14:33:21 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* thread_win32.c (thread_errno): CreateThread does not set errno.
+
+	* thread.c (thread_create_core): moved failure handling from
+	  native_thread_core().
+
+	* thread_pthread.c (native_thread_create): constified.
+
+Thu Nov 12 10:08:56 2009  NARUSE, Yui  <naruse@r...>
+
+	* .document: remove documents not in rdoc format until
+	  rdoc supports non rdoc files. [ruby-core:26459]
+
+Thu Nov 12 06:42:38 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* lib/tempfile.rb (Tempfile#initialize): option hash may not be
+	  given.  [ruby-core:26681]
+
+Thu Nov 12 01:29:15 2009  Yusuke Endoh  <mame@t...>
+
+	* enumerator.c (yielder_yield_push): Yielder#<< should return self.
+	  [ruby-dev:39660]
+
+Wed Nov 11 19:17:35 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* lib/tempfile.rb (Tempfile#initialize): merge mode option.
+
+	* lib/tmpdir.rb (Dir::Tmpname#create): splat options.
+
 Wed Nov 11 18:20:36 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* gc.c (rb_objspace_free): finalizer should have been done already.
Index: mvm/thread_pthread.c
===================================================================
--- mvm/thread_pthread.c	(revision 25728)
+++ mvm/thread_pthread.c	(revision 25729)
@@ -515,11 +515,7 @@
     else {
 	pthread_attr_t attr;
 	const size_t stack_size = RUBY_STACK_MIN;
-#if HAVE_SIGALTSTACK
-	const size_t space = 0;
-#else
 	const size_t space = RUBY_STACK_SPACE;
-#endif
 
 	th->machine_stack_maxsize = stack_size - space;
 #ifdef __ia64
@@ -546,11 +542,6 @@
 	if (!err) {
 	    pthread_cond_init(&th->native_thread_data.sleep_cond, 0);
 	}
-	else {
-	    st_delete_wrap(th->vm->living_threads, th->self);
-	    th->status = THREAD_KILLED;
-	    rb_raise(rb_eThreadError, "can't create Thread (%d)", err);
-	}
     }
     return err;
 }
Index: mvm/enumerator.c
===================================================================
--- mvm/enumerator.c	(revision 25728)
+++ mvm/enumerator.c	(revision 25729)
@@ -1009,6 +1009,13 @@
     return rb_proc_call(ptr->proc, args);
 }
 
+/* :nodoc: */
+static VALUE yielder_yield_push(VALUE obj, VALUE args)
+{
+    yielder_yield(obj, args);
+    return obj;
+}
+
 static VALUE
 yielder_yield_i(VALUE obj, VALUE memo, int argc, VALUE *argv)
 {
@@ -1231,7 +1238,7 @@
     rb_define_alloc_func(rb_cYielder, yielder_allocate);
     rb_define_method(rb_cYielder, "initialize", yielder_initialize, 0);
     rb_define_method(rb_cYielder, "yield", yielder_yield, -2);
-    rb_define_method(rb_cYielder, "<<", yielder_yield, -2);
+    rb_define_method(rb_cYielder, "<<", yielder_yield_push, -2);
 
     id_rewind = rb_intern("rewind");
     id_each = rb_intern("each");
Index: mvm/lib/tempfile.rb
===================================================================
--- mvm/lib/tempfile.rb	(revision 25728)
+++ mvm/lib/tempfile.rb	(revision 25729)
@@ -133,9 +133,17 @@
 
     create(basename, *rest) do |tmpname, n, opts|
       lock = tmpname + '.lock'
+      mode = File::RDWR|File::CREAT|File::EXCL
+      perm = 0600
+      if opts
+        mode |= opts.delete(:mode) || 0
+        opts[:perm] = perm
+      else
+        opts = perm
+      end
       self.class.mkdir(lock)
       begin
-        @data[1] = @tmpfile = File.open(tmpname, File::RDWR|File::CREAT|File::EXCL, 0600, *opts)
+        @data[1] = @tmpfile = File.open(tmpname, mode, opts)
         @data[0] = @tmpname = tmpname
       ensure
         self.class.rmdir(lock)
Index: mvm/lib/tmpdir.rb
===================================================================
--- mvm/lib/tmpdir.rb	(revision 25728)
+++ mvm/lib/tmpdir.rb	(revision 25729)
@@ -152,7 +152,7 @@
       n = nil
       begin
         path = File.expand_path(make_tmpname(basename, n), tmpdir)
-        yield(path, n, opts)
+        yield(path, n, *opts)
       rescue Errno::EEXIST
         n ||= 0
         n += 1
Index: mvm/thread.c
===================================================================
--- mvm/thread.c	(revision 25728)
+++ mvm/thread.c	(revision 25729)
@@ -535,6 +535,7 @@
 thread_create_core(VALUE thval, VALUE args, VALUE (*fn)(ANYARGS))
 {
     rb_thread_t *th;
+    int err;
 
     if (OBJ_FROZEN(GET_THREAD()->thgroup)) {
 	rb_raise(rb_eThreadError,
@@ -558,7 +559,12 @@
 #else
     th->cwd.path = rb_str_new_shared(GET_THREAD()->cwd.path);
 #endif
-    native_thread_create(th);
+    err = native_thread_create(th);
+    if (err) {
+	st_delete_wrap(th->vm->living_threads, th->self);
+	th->status = THREAD_KILLED;
+	rb_raise(rb_eThreadError, "can't create Thread (%d)", err);
+    }
     return thval;
 }
 
Index: mvm/.document
===================================================================
--- mvm/.document	(revision 25728)
+++ mvm/.document	(revision 25729)
@@ -16,17 +16,4 @@
 ext
 
 # rdoc files
-doc/*
-
-NEWS
-
-README.ja
-README
-README.EXT
-README.EXT.ja
-COPYING
-COPYING.ja
-GPL
-LGPL
-LEGAL
-ChangeLog
+doc/*.rdoc
Index: mvm/.merged-trunk-revision
===================================================================
--- mvm/.merged-trunk-revision	(revision 25728)
+++ mvm/.merged-trunk-revision	(revision 25729)
@@ -1 +1 @@
-25718
+25728
Index: mvm/version.h
===================================================================
--- mvm/version.h	(revision 25728)
+++ mvm/version.h	(revision 25729)
@@ -1,5 +1,5 @@
 #define RUBY_VERSION "1.9.2"
-#define RUBY_RELEASE_DATE "2009-11-11"
+#define RUBY_RELEASE_DATE "2009-11-12"
 #define RUBY_PATCHLEVEL -1
 #define RUBY_BRANCH_NAME "mvm"
 
@@ -8,7 +8,7 @@
 #define RUBY_VERSION_TEENY 1
 #define RUBY_RELEASE_YEAR 2009
 #define RUBY_RELEASE_MONTH 11
-#define RUBY_RELEASE_DAY 11
+#define RUBY_RELEASE_DAY 12
 
 #include "ruby/version.h"
 
Index: mvm/test/test_tempfile.rb
===================================================================
--- mvm/test/test_tempfile.rb	(revision 25728)
+++ mvm/test/test_tempfile.rb	(revision 25729)
@@ -3,6 +3,11 @@
 require_relative 'ruby/envutil'
 
 class TestTempfile < Test::Unit::TestCase
+  def initialize(*)
+    super
+    @tempfile = nil
+  end
+
   def tempfile(*args, &block)
     t = Tempfile.new(*args, &block)
     @tempfile = (t unless block)
@@ -45,13 +50,13 @@
 
   def test_basename
     t = tempfile("foo")
-    assert_match /^foo/, File.basename(t.path)
+    assert_match(/^foo/, File.basename(t.path))
   end
 
   def test_basename_with_suffix
     t = tempfile(["foo", ".txt"])
-    assert_match /^foo/, File.basename(t.path)
-    assert_match /\.txt$/, File.basename(t.path)
+    assert_match(/^foo/, File.basename(t.path))
+    assert_match(/\.txt$/, File.basename(t.path))
   end
 
   def test_unlink
@@ -284,5 +289,14 @@
     t.rewind
     assert_equal(Encoding::ASCII_8BIT,t.read.encoding)
   end
+
+  def test_binmode
+    t = tempfile("TEST", mode: IO::BINARY)
+    if IO::BINARY.nonzero?
+      assert(t.binmode?)
+    else
+      assert_equal(0600, t.stat.mode & 0777)
+    end
+  end
 end
 

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

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