From: Hiroshi Nakamura Date: 2011-11-19T08:24:00+09:00 Subject: [ruby-core:41144] Re: [Backport93 - Backport #5621] Please backport thread-safe autoloading patch This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig08B625E1453F11C9C84495C3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable (2011/11/19 6:31), Charles Oliver Nutter wrote: >> Sure. This deadlock from cross-require is intentional at this >> moment I believe, and that's the reason for the warning 'loading >> in progress, circular require considered harmful'. Related >> discussion is at #920. >>=20 >> I don't know how Java's classloader avoids this problem. >=20 > Each classloader has a single lock, and if it needs to call a > parent classloader the locks are still always acquired in the same > order (meaning deadlock is impossible). 1) No parallel loading in single classloader (single lock, disallowing concurrent loading) 2) Classloaders know class loading order at compile time to avoid deadlock Am I right? > I don't see how it can be fixed if concurrent requires are > allowed, but individual files have their own locks. If there's ever > any potential for two different locks to be acquired by two threads > in opposing order, it can deadlock. Indeed. Warning would be the best we can do. > You're right, though...it's important to point out Yehuda's problem > is not an autoload problem. Autoload thread-safety itself is > achievable. Require thread-safety doesn't exist even today. That's > the real problem. Sure. Moreover, I think that require thread-safety could not be solved easily in Ruby, so I want to find a different way to solve Yehuda's real problem. --------------enig08B625E1453F11C9C84495C3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) iQEcBAEBAgAGBQJOxuj5AAoJEC7N6P3yLbI2Ku4IANbn9ryxPEHZHzyl/h8hz59g Egw5E5mgAuldwurWfi+RmSHXciXmMFdltHQeTcqqAWQxZOIqxEF5699QSAJHmKbn TzJY+DrS1abBdiKwokMJf9orQxW90U4GPVC5vhwdCKP3/XBpiGgiZvoWd1pdiiug JVtynfm2vyuOv+euBHAlXn93jdKR3DJAJNmkcoVhMtE5qLgi4++5+CdDUpDGnwP9 d3CHUnTvejM32HOqh0zO9RlIph532dW24Wx6pdq8F+/TWSkoa3Nsr+nMtRplmgoh tW/0f6Uf8DqRqClikNJp3XQU1XPWS5KwEdbfz+EN1UTXxhPlBfXQuZxhcJmtu0c= =PLYS -----END PGP SIGNATURE----- --------------enig08B625E1453F11C9C84495C3--