aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_fiber.rb
Commit message (Collapse)AuthorAgeFilesLines
* increase timeout for Solaris 10 SPARCnaruse2016-01-261-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add frozen_string_literal: false for all filesnaruse2015-12-161-0/+1
| | | | | | When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby: suppress warningsnobu2014-11-291-1/+1
| | | | | | | | | | | | | | | * test/ruby/test_array.rb: (need_continuation): suppress warnings to require continuation. * test/ruby/test_continuation.rb: ditto. * test/ruby/test_enum.rb: ditto. * test/ruby/test_fiber.rb: ditto. * test/ruby/test_hash.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c: UncaughtThrowErrornobu2014-11-151-1/+1
| | | | | | | * vm_eval.c (rb_throw_obj): throw UncaughtThrowError instead of ArgumentError. [Feature #10480] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/lib/envutil.rb: Moved from test/ruby/.akr2014-11-131-1/+0
| | | | | | | | | | | | | | * test/lib/find_executable.rb: Ditto. * test/lib/memory_status.rb: Ditto. * test/lib/test/unit.rb: require envutil. * test/: Don't require envutil in test files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby: get rid of warnings.usa2014-03-041-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_fiber.rb: remove corenobu2013-12-141-1/+4
| | | | | | | * test/ruby/test_fiber.rb (TestFiber#invoke_rec): remove core dump files by stack overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby: better assertionsnobu2013-12-131-4/+4
| | | | | | * test/ruby: use better assertions instead of mere assert. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_fiber.rb: collect garbage fibers immediately.ko12013-08-191-1/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c, vm_method.c: remove dead code.ktsj2013-08-181-4/+1
| | | | | | | * test/ruby/test_fiber.rb, test/ruby/test_thread.rb: change accordingly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_fiber.rb: longer timeoutnobu2013-06-201-2/+2
| | | | | | | * test/ruby/test_fiber.rb (test_many_fibers): make timeout longer. 10sec is not sufficient. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby: reap zombiesnobu2013-06-191-2/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cont.c: fiber local svarnobu2013-01-301-0/+24
| | | | | | | * cont.c (cont_restore_thread): svar should be separate per fibers. [ruby-core:51331] [Bug #7678] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Sync output messagenaruse2013-01-221-8/+8
| | | | | | | | | | * sync $stdout to ensure outputting on expected SEGV. this caused failure: http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20130121T230101Z.log.html.gz * check result of invoke_ruby * use assert_operator git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Remove commenting out tests introduced by r38478naruse2013-01-161-4/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (rb_fiber_start): in case of jump with TAG_FATAL,nagachika2012-12-221-1/+1
| | | | | | | | | | | | | | | | | enqueue error into async_errinfo_queue, because you cannot call TH_TAG_JUMP() in this function. [ruby-dev:45218] [Bug #5993] * thread.c (rb_threadptr_execute_interrupts): now INT2FIX(TAG_FATAL) can be popped from async_errinfo_queue. * vm.c (rb_vm_make_jump_tag_but_local_jump): revert r38441. rb_vm_make_jump_tag_but_local_jump() shouldn't return exception in case of state == TAG_FATAL. * test/ruby/test_fiber.rb (test_exit_in_fiber): fix a test to illuminate Thread.exit should terminate current Thread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c: support variable VM/Machine stack sizes.ko12012-12-191-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specified by the following environment variaables: - RUBY_THREAD_VM_STACK_SIZE: vm stack size used at thread creation. default: 128KB (32bit CPU) or 256KB (64bit CPU). - RUBY_THREAD_MACHINE_STACK_SIZE: machine stack size used at thread creation. default: 512KB or 1024KB. - RUBY_FIBER_VM_STACK_SIZE: vm stack size used at fiber creation. default: 64KB or 128KB. - RUBY_FIBER_MACHINE_STACK_SIZE: machine stack size used at fiber creation. default: 256KB or 256KB. This values are specified at launched timing. You can not change these values at running time. Environ variables are only *hints* because: - They are aligned to 4KB. - They have minimum values (depend on OSs). - Machine stack settings are ignored by some OSs. Default values especially fiber stack sizes are increased. This change affect Fiber's behavior: (1) You can run more complex program on a Fiber. (2) You can not make many (thousands) Fibers because of lack of address space (on 32bit CPU). If (2) bothers you, (a) Use 64bit CPU with big memory, or (b) Specify RUBY_FIBER_(VM|MACHINE)_STACK_SIZE correctly. You need to choose correct stack size carefully. These values are completely rely on systems (OS/compiler and so on). * vm_core.h (rb_vm_t::default_params): add to record above settings. * vm.c (RubyVM::DEFAULT_PARAMS): add new constant to see above setting. * thread_pthread.c: support RUBY_THREAD_MACHINE_STACK_SIZE. * cont.c: support RUBY_FIBER_(VM|MACHINE)_STACK_SIZE. * test/ruby/test_fiber.rb: add tests for above. * test/ruby/test_thread.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_fiber.rb: remove a strange single quote character.ko12012-12-191-1/+1
| | | | | | | | With this character, this script exits by SyntaxError. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c (rb_vm_make_jump_tag_but_local_jump): take care of the casenagachika2012-12-181-0/+9
| | | | | | | | | | TAG_JUMP() with TAG_FATAL (ex. rb_fatal()). * test/ruby/test_fiber.rb (test_fatal_in_fiber): add a test for above. * ext/-test-/fatal/extconf.rb, ext/-test-/fatal/rb_fatal.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (rb_fiber_start): don't enqueue Qnil to async_errinfo_queue.nagachika2012-12-151-0/+7
| | | | | | | | | rb_vm_make_jump_tag_but_local_jump() could return Qnil (ex. when finished by Thread.exit). [ruby-dev:45218] [Bug #5993] * test/ruby/test_fiber.rb (test_exit_in_fiber): add test for it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use assert_normal_exit to split processnaruse2012-10-291-11/+12
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (rb_mod_using): new method Module#using. [experimental]shugo2012-08-021-4/+1
| | | | | | | | * eval.c (rb_mod_refine): new method Module#refine. [experimental] * eval.c (f_using): new method Kernel#using. [experimental] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (rb_fiber_reset_root_local_storage): add a new function tonagachika2012-02-151-0/+16
| | | | | | | | | | | | | | | | | | | | | | | restore rb_thread_t::local_storage. * cont.c (rb_obj_is_fiber): add a new function to tell finalizer to prevent fibers from destroy. * gc.c (rb_objspace_call_finalizer): don't sweep fibers at finalizing objspace. * internal.h (rb_fiber_reset_root_local_storage, rb_obj_is_fiber): add prototypes. * vm.c (ruby_vm_destruct): reset main thread's local_storage before free main thread. rb_thread_t::local_storage is replaced by fiber's local storage when forked from fiber, and it should be already freed when the fiber was destroyed. * test/ruby/test_fiber.rb (test_fork_from_fiber): add test for fork from fiber. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (fiber_switch): ignore fiber context switchnaruse2011-11-201-0/+5
| | | | | | | | because destination fiber is same as current fiber. With out this, it may segv on FreeBSD 9. patched by Koichi Sasada. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_fiber.rb: add tests for r33684 (Fiber#resume).ko12011-11-091-0/+23
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_fiber.rb (TestFiber#test_no_valid_cfp):ktsj2011-09-031-0/+12
| | | | | | | add a test. Unlike TestThread#test_no_valid_cfp, this test succeeds even if win32ole is required (see r33153). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (cont_init): clear macihne_stack_start/end of saved thread tonagachika2011-05-151-0/+11
| | | | | | | | prevent mark machine stack of GC'ed Thread. root Fiber is not initialized by fiber_init(). based on a patch by Serge Balyuk [ruby-core:35891] fixes #4612 * test/ruby/test_fiber.rb (test_gc_root_fiber): add test for it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (rb_fiber_resume): raise an "double resume" error when rootmame2010-11-031-0/+8
| | | | | | fiber is going to be resumed. [ruby-dev:42523] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_fiber.rb: add ML ref.mame2010-05-091-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (fiber_switch): raise FiberError when returning to deadmame2010-05-091-0/+11
| | | | | | fiber. [ruby-dev:40833] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (cont_capture, fiber_store): reraise transferred error.nobu2009-06-011-0/+5
| | | | | | | | * cont.c (fiber_switch): transfers dead fiber error to the previouse or root fiber if the current fiber is dead. [ruby-core:23651] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * {ext,lib,test}/**/*.rb: removed trailing spaces.nobu2009-03-061-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (rb_fiber_alive_p): fix to return true instead of 1.ko12009-02-131-0/+9
| | | | | | | | | [ruby-dev:37991] * test/ruby/test_fiber.rb: add a test for Fiber#alive? git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (rb_fiber_start): calls with exact argument number.nobu2008-12-011-0/+4
| | | | | | | [ruby-core:20088] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c: Thread local storage should be fiber local.ko12007-09-281-0/+29
| | | | | | | | | * bootstraptest/test_knownbug.rb, test/ruby/test_fiber.rb: move a fixed test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_fiber.rb (TestFiber::test_throw): uncaught throwmatz2007-09-071-1/+1
| | | | | | now raise ArgumentError exception. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_fiber.rb: fix to require 'continuation'.ko12007-08-251-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c: separate Continuation and Fiber from core.ko12007-08-251-2/+3
| | | | | | | | | | | | | | * ext/continuation/*, ext/fiber/*: ditto. * include/ruby/ruby.h: remove rb_cFiber. * include/ruby/intern.h: add the rb_fiber_new() declaration. * enumerator.c (next_init): fix to use rb_fiber_new(). * test/ruby/test_enumerator.rb: remove next? tests. * test/ruby/test_continuation.rb: add a require 'continuation'. * test/ruby/test_fiber.rb: add a require 'fiber'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c: add Fiber#resume and Fiber.yield.ko12007-08-211-30/+51
| | | | | | | | | | | and Fiber::Core class to realize Coroutine. * include/ruby/intern.h: declare rb_fiber_yield(), rb_fiber_resume(), * enumerator.c: use above api. * test/ruby/test_fiber.rb: fix and add tests for above changes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (rb_cont_call): forbid cross fiber continuation call.ko12007-06-151-24/+6
| | | | | | | | * test/ruby/test_fiber.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (cont_restore_1): fix to check root fiber [ruby-dev:30911].ko12007-06-071-1/+9
| | | | | | | | * test/ruby/test_fiber.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test_fiber.rb: add a test (Continuation and Fiber).ko12007-06-061-0/+16
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (cont_new): add debug message.ko12007-06-061-0/+17
| | | | | | | | | | | | * cont.c (cont_restore_1): copy stack information from fiber. * cont.c (rb_fiber_s_new): fix to mark created fiber. * test/ruby/test_fiber.rb: add some tests around Thread and Fiber. * yarvcore.c (thread_free): fix to skip freeing stack if root fiber is available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (rb_fiber_start): clear th->tag and check error to fixko12007-06-051-0/+16
| | | | | | | | | | [ruby-dev:30888] and [ruby-dev:30889]. * eval_intern.h: fix rb_fiber_start() prototype. * test/ruby/test_fiber.rb: add tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (Fiber#pass): rename to Fiber#yield. Block parameterko12007-06-021-14/+21
| | | | | | | | | | | of fiber body receive first yield values. e.g.: Fiber.new{|x| p x}.yield(:ok) #=> :ok * cont.c: rename rb_context_t#retval to rb_context_t#value. * test/ruby/test_fiber.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c: support Fiber. Check test/ruby/test_fiber.rb for detail.ko12007-05-271-0/+66
Fiber is known as "Micro Thread", "Coroutine", and other terms. At this time, only Fiber#pass is supported to change context. I want to know more suitable method name/API for Fiber (... do you know more suitable class name instead of Fiber?) as "suspend/resume", "call", "yield", "start/kick/stop/restart", .... * eval.c, eval_intern.h, thread.c, yarvcore.c, yarvcore.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e