diff options
author | Jean Boussier <byroot@ruby-lang.org> | 2023-02-06 12:30:50 +0100 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2023-02-06 19:35:38 +0100 |
commit | fa49651e05a06512e18ccb2f54a7198c9ff579de (patch) | |
tree | 76f9cd0a4fc774ea236d33ec4d8b396b0b85da37 /load.c | |
parent | 28da9909849dc02abe74de8170fe4036534361ba (diff) |
Only emit circular dependency warning for owned thread shields
[Bug #19415]
If multiple threads attemps to load the same file concurrently
it's not a circular dependency issue.
So we check that the existing ThreadShield is owner by the current
fiber before warning about circular dependencies.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7252
Diffstat (limited to 'load.c')
-rw-r--r-- | load.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -850,7 +850,8 @@ 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) { + + if (warn && rb_thread_shield_owned((VALUE)data)) { 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); |