[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] RFC: Different ThreadLocal implementation
From: |
Jeroen Frijters |
Subject: |
[cp-patches] RFC: Different ThreadLocal implementation |
Date: |
Thu, 17 Feb 2005 11:10:28 +0100 |
Hi,
I'd like to propose a different way to implement ThreadLocal. The patch
is attached. It trades using WeakHashMaps for one additional field in
Thread, which I think is a good trade. It is also completely lock free.
Note that it also fixes a bug in InheritableThreadLocal:
- local.valueMap.put(childThread, (childValue == null
- ? NULL :
parentValue));
Any comments?
Regards,
Jeroen
2005-02-17 Jeroen Frijters <address@hidden>
* java/lang/InheritableThreadLocal.java
(threadMap): Removed.
(InheritableThreadLocal): Removed code.
(newChildThread): Changed to use locals map in Thread.
* java/lang/Thread.java
(locals): New field.
(die): Clear locals field.
(getThreadLocals): New method.
* java/lang/ThreadLocal.java
(value): Removed.
(valueMap): Removed.
(get,set): Changed to use locals map in Thread.
ThreadLocal.patch.txt
Description: ThreadLocal.patch.txt
- [cp-patches] RFC: Different ThreadLocal implementation,
Jeroen Frijters <=