Commit graph

10 commits

Author SHA1 Message Date
nagachika
26b3f0b6a9 merge revision(s) 8ce2fb9bbbaea14737c84385b1573f743a30f773,3a0f6ce1d31eefd8af01b50f3632a64d64e8f8c1: [Backport #19415]
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.
	---
	 internal/thread.h                                     |  1 +
	 load.c                                                |  3 ++-
	 spec/ruby/core/kernel/shared/require.rb               | 11 +++++++++++
	 spec/ruby/fixtures/code/concurrent_require_fixture.rb |  4 ++++
	 test/ruby/test_require.rb                             |  3 ---
	 thread.c                                              | 11 +++++++++++
	 6 files changed, 29 insertions(+), 4 deletions(-)
	 create mode 100644 spec/ruby/fixtures/code/concurrent_require_fixture.rb

	Use Thread.pass until thread.stop? to wait for thread to block

	[Bug #19415]

	It should be more reliable
	---
	 spec/ruby/fixtures/code/concurrent_require_fixture.rb | 2 +-
	 1 file changed, 1 insertion(+), 1 deletion(-)
2023-03-21 15:32:44 +09:00
卜部昌平
daf0c04a47 internal/*.h: skip doxygen
These contents are purely implementation details, not worth appearing in
CAPI documents. [ci skip]
2021-09-10 20:00:06 +09:00
Samuel Williams
a08ee8330d Rename to Fiber#set_scheduler. 2020-11-07 23:39:50 +13:00
Samuel Williams
d387029f39 Standardised scheduler interface. 2020-09-14 16:44:09 +12:00
Samuel Williams
703e529751 Add rb_thread_current_scheduler(). 2020-09-14 16:44:09 +12:00
Samuel Williams
1b3a6847be Move declarations to private internal/thread.h header. 2020-07-20 13:20:58 +12:00
卜部昌平
4ff3f20540 add #include guard hack
According to MSVC manual (*1), cl.exe can skip including a header file
when that:

- contains #pragma once, or
- starts with #ifndef, or
- starts with #if ! defined.

GCC has a similar trick (*2), but it acts more stricter (e. g. there
must be _no tokens_ outside of #ifndef...#endif).

Sun C lacked #pragma once for a looong time.  Oracle Developer Studio
12.5 finally implemented it, but we cannot assume such recent version.

This changeset modifies header files so that each of them include
strictly one #ifndef...#endif.  I believe this is the most portable way
to trigger compiler optimizations. [Bug #16770]

*1: https://docs.microsoft.com/en-us/cpp/preprocessor/once
*2: https://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.html
2020-04-13 16:06:00 +09:00
卜部昌平
9e6e39c351
Merge pull request #2991 from shyouhei/ruby.h
Split ruby.h
2020-04-08 13:28:13 +09:00
卜部昌平
e0b1be0162 internal/thread.h rework
Rather trivial, added missed MJIT_FUNC_EXPORTED function declaration.
2019-12-26 20:45:12 +09:00
卜部昌平
b739a63eb4 split internal.h into files
One day, I could not resist the way it was written.  I finally started
to make the code clean.  This changeset is the beginning of a series of
housekeeping commits.  It is a simple refactoring; split internal.h into
files, so that we can divide and concur in the upcoming commits.  No
lines of codes are either added or removed, except the obvious file
headers/footers.  The generated binary is identical to the one before.
2019-12-26 20:45:12 +09:00