diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-04 10:30:56 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-04 10:30:56 +0000 |
| commit | bf40bc6837ad7f2981b86d360cb91dad41d9e9ef (patch) | |
| tree | b77c08916f86e0042f4890f479831da96c500882 /test/ruby | |
| parent | c46c1db70fdda02a574c56bd776e04f073e0c5cd (diff) | |
* marshal.c (struct {dump,load}_arg): manage with dfree, instead
of using local variable which may be moved by context switch.
[ruby-dev:39425]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@25230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_marshal.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb index 68f50ff728..046c258b85 100644 --- a/test/ruby/test_marshal.rb +++ b/test/ruby/test_marshal.rb @@ -71,4 +71,32 @@ class TestMarshal < Test::Unit::TestCase } assert_equal("marshal data too short", e.message) end + + class DumpTest + def marshal_dump + loop { Thread.pass } + end + end + + class LoadTest + def marshal_dump + nil + end + def marshal_load(obj) + loop { Thread.pass } + end + end + + def test_context_switch + o = DumpTest.new + Thread.new { Marshal.dump(o) } + GC.start + assert(true, '[ruby-dev:39425]') + + o = LoadTest.new + m = Marshal.dump(o) + Thread.new { Marshal.load(m) } + GC.start + assert(true, '[ruby-dev:39425]') + end end |
