Improving ThreadLocalRandom (and related classes) (original) (raw)
Doug Lea dl at cs.oswego.edu
Tue Jan 8 17:33:32 UTC 2013
- Previous message: Improving ThreadLocalRandom (and related classes)
- Next message: Improving ThreadLocalRandom (and related classes)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 01/08/13 11:07, Chris Hegarty wrote:
Doug,
I have no objection as such to adding certain fields to j.l.Thread to support faster ThreadLocalRandom. Maybe it would help to see how they are to be used?
Sorry, it just occurred to me that you surely meant: how would these Thread fields be used in ThreadLocalRandom. here's the basic plan:
There is a singleton TLR that is always returned by TLR.current after first checking (via nonzero probe) if initialized for this thread.
On a call to next() etc, this object accesses and updates threadLocalRandomSeed using Unsafe (to bypass access control).
-Doug
- Previous message: Improving ThreadLocalRandom (and related classes)
- Next message: Improving ThreadLocalRandom (and related classes)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]