* cont.c (rb_fiber_m_transfer, rb_fiber_resume): prohibit using
"resume" after "transfer" method are used. You should not mix "resume" fiber and "transfer" fiber. [Bug #5526] * NEWS: add information about this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b2c44e7af5
commit
9cd8b76e6d
@ -1,3 +1,12 @@
|
|||||||
|
Thu Nov 10 05:17:25 2011 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* cont.c (rb_fiber_m_transfer, rb_fiber_resume): prohibit using
|
||||||
|
"resume" after "transfer" method are used. You should not mix
|
||||||
|
"resume" fiber and "transfer" fiber.
|
||||||
|
[Bug #5526]
|
||||||
|
|
||||||
|
* NEWS: add information about this change.
|
||||||
|
|
||||||
Wed Nov 9 11:40:37 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Wed Nov 9 11:40:37 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* template/Doxyfile.tmpl (INCLUDE_PATH): add srcdir and include.
|
* template/Doxyfile.tmpl (INCLUDE_PATH): add srcdir and include.
|
||||||
|
4
NEWS
4
NEWS
@ -32,6 +32,10 @@ with all sufficient information, see the ChangeLog file.
|
|||||||
* Time#to_s returned encoding defaults to US-ASCII but automatically
|
* Time#to_s returned encoding defaults to US-ASCII but automatically
|
||||||
transcodes to Encoding.default_internal if it is set.
|
transcodes to Encoding.default_internal if it is set.
|
||||||
|
|
||||||
|
* Fiber
|
||||||
|
* incompatible changes:
|
||||||
|
* Fiber#resume cannot resume a fiber which invokes "Fiber#transfer".
|
||||||
|
|
||||||
* net/imap
|
* net/imap
|
||||||
* new methods:
|
* new methods:
|
||||||
* Net::IMAP.default_port
|
* Net::IMAP.default_port
|
||||||
|
16
cont.c
16
cont.c
@ -103,6 +103,12 @@ typedef struct rb_fiber_struct {
|
|||||||
enum fiber_status status;
|
enum fiber_status status;
|
||||||
struct rb_fiber_struct *prev_fiber;
|
struct rb_fiber_struct *prev_fiber;
|
||||||
struct rb_fiber_struct *next_fiber;
|
struct rb_fiber_struct *next_fiber;
|
||||||
|
/* If a fiber invokes "transfer",
|
||||||
|
* then this fiber can't "resume" any more after that.
|
||||||
|
* You shouldn't mix "transfer" and "resume".
|
||||||
|
*/
|
||||||
|
int transfered;
|
||||||
|
|
||||||
#if FIBER_USE_NATIVE
|
#if FIBER_USE_NATIVE
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
void *fib_handle;
|
void *fib_handle;
|
||||||
@ -1322,6 +1328,9 @@ rb_fiber_resume(VALUE fibval, int argc, VALUE *argv)
|
|||||||
if (fib->prev != Qnil || fib->cont.type == ROOT_FIBER_CONTEXT) {
|
if (fib->prev != Qnil || fib->cont.type == ROOT_FIBER_CONTEXT) {
|
||||||
rb_raise(rb_eFiberError, "double resume");
|
rb_raise(rb_eFiberError, "double resume");
|
||||||
}
|
}
|
||||||
|
if (fib->transfered != 0) {
|
||||||
|
rb_raise(rb_eFiberError, "cannot resume transferred Fiber");
|
||||||
|
}
|
||||||
|
|
||||||
return fiber_switch(fibval, argc, argv, 1);
|
return fiber_switch(fibval, argc, argv, 1);
|
||||||
}
|
}
|
||||||
@ -1389,9 +1398,12 @@ rb_fiber_m_resume(int argc, VALUE *argv, VALUE fib)
|
|||||||
* back to this fiber before it can yield and resume.
|
* back to this fiber before it can yield and resume.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_fiber_m_transfer(int argc, VALUE *argv, VALUE fib)
|
rb_fiber_m_transfer(int argc, VALUE *argv, VALUE fibval)
|
||||||
{
|
{
|
||||||
return rb_fiber_transfer(fib, argc, argv);
|
rb_fiber_t *fib;
|
||||||
|
GetFiberPtr(fibval, fib);
|
||||||
|
fib->transfered = 1;
|
||||||
|
return rb_fiber_transfer(fibval, argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user