зеркало из https://github.com/github/ruby.git
Revert "Only emit circular dependency warning for owned thread shields"
This reverts commit fa49651e05
.
This commit is contained in:
Родитель
c30602e64c
Коммит
c19defd026
|
@ -29,7 +29,6 @@ VALUE rb_get_coverages(void);
|
|||
int rb_get_coverage_mode(void);
|
||||
VALUE rb_default_coverage(int);
|
||||
VALUE rb_thread_shield_new(void);
|
||||
bool rb_thread_shield_owned(VALUE self);
|
||||
VALUE rb_thread_shield_wait(VALUE self);
|
||||
VALUE rb_thread_shield_release(VALUE self);
|
||||
VALUE rb_thread_shield_destroy(VALUE self);
|
||||
|
|
3
load.c
3
load.c
|
@ -850,8 +850,7 @@ load_lock(rb_vm_t *vm, const char *ftptr, bool warn)
|
|||
st_insert(loading_tbl, (st_data_t)ftptr, data);
|
||||
return (char *)ftptr;
|
||||
}
|
||||
|
||||
if (warn && rb_thread_shield_owned((VALUE)data)) {
|
||||
if (warn) {
|
||||
VALUE warning = rb_warning_string("loading in progress, circular require considered harmful - %s", ftptr);
|
||||
rb_backtrace_each(rb_str_append, warning);
|
||||
rb_warning("%"PRIsVALUE, warning);
|
||||
|
|
|
@ -237,16 +237,6 @@ describe :kernel_require, shared: true do
|
|||
}.should complain(/circular require considered harmful/, verbose: true)
|
||||
ScratchPad.recorded.should == [:loaded]
|
||||
end
|
||||
|
||||
ruby_bug "#17340", ''...'3.3' do
|
||||
it "loads a file concurrently" do
|
||||
path = File.expand_path "concurrent_require_fixture.rb", CODE_LOADING_DIR
|
||||
ScratchPad.record(@object)
|
||||
-> {
|
||||
@object.require(path)
|
||||
}.should_not complain(/circular require considered harmful/, verbose: true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "(non-extensioned path)" do
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Thread.new { ScratchPad.recorded.require(__FILE__) }.join(0.1)
|
|
@ -562,6 +562,9 @@ class TestRequire < Test::Unit::TestCase
|
|||
|
||||
assert_equal(true, (t1_res ^ t2_res), bug5754 + " t1:#{t1_res} t2:#{t2_res}")
|
||||
assert_equal([:pre, :post], scratch, bug5754)
|
||||
|
||||
assert_match(/circular require/, output)
|
||||
assert_match(/in #{__method__}'$/o, output)
|
||||
}
|
||||
ensure
|
||||
$VERBOSE = verbose
|
||||
|
|
11
thread.c
11
thread.c
|
@ -4920,17 +4920,6 @@ rb_thread_shield_new(void)
|
|||
return thread_shield;
|
||||
}
|
||||
|
||||
bool
|
||||
rb_thread_shield_owned(VALUE self)
|
||||
{
|
||||
VALUE mutex = GetThreadShieldPtr(self);
|
||||
if (!mutex) return false;
|
||||
|
||||
rb_mutex_t *m = mutex_ptr(mutex);
|
||||
|
||||
return m->fiber == GET_EC()->fiber_ptr;
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait a thread shield.
|
||||
*
|
||||
|
|
Загрузка…
Ссылка в новой задаче