commit-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug #3229] ThreadLocal and InheritableThreadLocal need to synchronize a


From: nobody
Subject: [Bug #3229] ThreadLocal and InheritableThreadLocal need to synchronize access to the map
Date: Wed, 16 Apr 2003 02:48:42 -0400

=================== BUG #3229: FULL BUG SNAPSHOT ===================
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=3229&group_id=85

Submitted by: davidholmes             Project: classpath                    
Submitted on: Wed 04/16/2003 at 16:48
Severity:  5 - Major                  Resolution:  None                     
Assigned to:  None                    Status:  Open                         
Platform Version:  None               

Summary:  ThreadLocal and InheritableThreadLocal need to synchronize access to 
the map

Original Submission:  Inside Threadlocal and InheritableThreadLocal are 
comments like:

// Note that we don't have to synchronize, as only this 
//thread will ever modify the returned value.

While it is true that only one thread will ever deal with the return value from 
the map, the map itself is written and read concurrently by multiple threads. 
Hence access to the map *must* be synchronized.

Note that there is a much better way to implement thread locals that avoids the 
need for any synchronization. Unfortunately I can't say anymore as the 
technique is used by the JDK. Think carefully about what it means to be 
thread-local. You might also want to checkout how other systems implement 
thread-local storage.



No Followups Have Been Posted


CC list is empty


No files currently attached


For detailed info, follow this link:
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=3229&group_id=85




reply via email to

[Prev in Thread] Current Thread [Next in Thread]