mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
merge revision(s) 04ec077946
: [Backport #21038]
Preserve `errno` in `rb_fiber_scheduler_unblock`. (#12576) [Bug #21038] Co-authored-by: Julian Scheid <julians37@gmail.com>
This commit is contained in:
parent
3fdf7279a0
commit
2108ab2cb6
2 changed files with 10 additions and 2 deletions
10
scheduler.c
10
scheduler.c
|
@ -412,7 +412,15 @@ rb_fiber_scheduler_unblock(VALUE scheduler, VALUE blocker, VALUE fiber)
|
||||||
{
|
{
|
||||||
RUBY_ASSERT(rb_obj_is_fiber(fiber));
|
RUBY_ASSERT(rb_obj_is_fiber(fiber));
|
||||||
|
|
||||||
return rb_funcall(scheduler, id_unblock, 2, blocker, fiber);
|
// `rb_fiber_scheduler_unblock` can be called from points where `errno` is expected to be preserved. Therefore, we should save and restore it. For example `io_binwrite` calls `rb_fiber_scheduler_unblock` and if `errno` is reset to 0 by user code, it will break the error handling in `io_write`.
|
||||||
|
// If we explicitly preserve `errno` in `io_binwrite` and other similar functions (e.g. by returning it), this code is no longer needed. I hope in the future we will be able to remove it.
|
||||||
|
int saved_errno = errno;
|
||||||
|
|
||||||
|
VALUE result = rb_funcall(scheduler, id_unblock, 2, blocker, fiber);
|
||||||
|
|
||||||
|
errno = saved_errno;
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
|
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
|
||||||
#define RUBY_VERSION_TEENY 1
|
#define RUBY_VERSION_TEENY 1
|
||||||
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
|
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
|
||||||
#define RUBY_PATCHLEVEL 18
|
#define RUBY_PATCHLEVEL 19
|
||||||
|
|
||||||
#include "ruby/version.h"
|
#include "ruby/version.h"
|
||||||
#include "ruby/internal/abi.h"
|
#include "ruby/internal/abi.h"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue