diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-09 20:25:01 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-09 20:25:01 +0000 |
commit | 4bfa061e52c723e051d172c2d85cefb92aead1d9 (patch) | |
tree | c48ffa56f8ddc5406a89175413b288316358db69 /cont.c | |
parent | 47bb7f37a10a2d6c2d6075f3075a7f8cbe20bcfe (diff) |
Partially revert r27949.
* cont.c (fiber_setcontext): Use longjmp() instead of swapcontext() on
FreeBSD 9. [ruby-dev:41316] [Bug #3295] [Bug #5526]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'cont.c')
-rw-r--r-- | cont.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -646,6 +646,17 @@ fiber_setcontext(rb_fiber_t *newfib, rb_fiber_t *oldfib) /* swap machine context */ #ifdef _WIN32 SwitchToFiber(newfib->fib_handle); +#elif defined(__FreeBSD__) /* FreeBSD 9 doesn't work with swapcontext */ + if (!ruby_setjmp(oldfib->cont.jmpbuf)) { + if (newfib->status != RUNNING) { + if (setcontext(&newfib->context) < 0) { + rb_bug("context switch between fiber failed"); + } + } + else { + ruby_longjmp(newfib->cont.jmpbuf, 1); + } + } #else swapcontext(&oldfib->context, &newfib->context); #endif |