From: Aaron Patterson Date: 2012-10-02T09:42:12+09:00 Subject: [ruby-core:47802] Re: [ruby-trunk - Bug #7097][Assigned] Thread locals don't work inside Enumerator --CE+1k2dSO48ffgeK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 02, 2012 at 08:32:51AM +0900, SASADA Koichi wrote: > (2012/10/02 8:22), SASADA Koichi wrote: > >=20 > > One idea is: > >=20 > > - Define: Thread#[] -> Thred#current_fiber#[] > > - Add: Thread#truly_thread_local_get(key) > > and Thread#truly_thread_local_set(key, val) > >=20 > > (of course, truly_... is temporal name) I prefer this solution. I want a way to set true thread locals. > Another idea: >=20 > Add an option to derive Fiber local storage at a Fiber creation. >=20 > For example: >=20 > Thread[:foo] =3D :bar > Fiber.new(derive_fiber_local_storage: true) do > Thread[:foo] #=3D> :bar > end >=20 > And use Fiber in enumerator with this option true. I think the "true thread local" solution is better than this because I can use it with existing fiber based code. If a third party library uses Fibers, and I want thread locals, it would not be possible with this solution. --=20 Aaron Patterson http://tenderlovemaking.com/ --CE+1k2dSO48ffgeK Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (Darwin) iQEcBAEBAgAGBQJQajhdAAoJEJUxcLy0/6/GP3AIAKSvmV7VvreMOgQqe0ixEG+i dg1GjE8HvyRcWfjqEMj2Np+olNt0yGWo8edsioL3Rrq8zINumBP9pE+Z8cSjU8PN Ej0zvgK2Jl1N15RtNC1DQ/y9MCDm2QUfq7EwBmDnhK60B9s9Gwcc5NZo7df2eezX I3qZh5nFVJqdBsTiHDpqJQTnuRvWnwUYHiJ/PGiemFq5TCNtNJiX0OWstTAgSRJw yIARDZu/wZIdE3pLV+f9oSA7YmLkNoZw2hVXm9+4jf8DEW7+UY3jMETETAUUu5G0 tViGbzxrJtbFHi9vTVwH0VxNbedEkHlMEgjycfmZlk17xSHPBtlFdI7CjFkdZ5o= =edDt -----END PGP SIGNATURE----- --CE+1k2dSO48ffgeK--