Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
53a282ac
Commit
53a282ac
authored
Mar 18, 2014
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stricter check for double resume; close #1885
parent
31b2980a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
mrbgems/mruby-fiber/src/fiber.c
mrbgems/mruby-fiber/src/fiber.c
+1
-1
mrbgems/mruby-fiber/test/fiber.rb
mrbgems/mruby-fiber/test/fiber.rb
+13
-0
No files found.
mrbgems/mruby-fiber/src/fiber.c
View file @
53a282ac
...
...
@@ -164,7 +164,7 @@ fiber_resume(mrb_state *mrb, mrb_value self)
mrb_raise
(
mrb
,
E_ARGUMENT_ERROR
,
"can't cross C function boundary"
);
}
}
if
(
c
->
status
==
MRB_FIBER_RUNNING
)
{
if
(
c
->
status
==
MRB_FIBER_RUNNING
||
(
mrb
->
c
->
prev
&&
mrb
->
c
->
prev
!=
mrb
->
root_c
)
)
{
mrb_raise
(
mrb
,
E_RUNTIME_ERROR
,
"double resume"
);
}
if
(
c
->
status
==
MRB_FIBER_TERMINATED
)
{
...
...
mrbgems/mruby-fiber/test/fiber.rb
View file @
53a282ac
...
...
@@ -88,3 +88,16 @@ assert('Double resume of Fiber') do
assert_false
f1
.
alive?
assert_false
f2
.
alive?
end
assert
(
'Recursive resume of Fiber'
)
do
f1
,
f2
=
nil
,
nil
f1
=
Fiber
.
new
{
assert_raise
(
RuntimeError
)
{
f2
.
resume
}
}
f2
=
Fiber
.
new
{
f1
.
resume
Fiber
.
yield
0
}
assert_equal
0
,
f2
.
resume
f2
.
resume
assert_false
f1
.
alive?
assert_false
f2
.
alive?
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment