Commit Graph
6 Commits
Author SHA1 Message Date
Marek Safar afa79435aa Update for mobile profile 2013-02-07 16:34:21 +01:00
Marek Safar 510a2941c4 Move ConcurrentBag tests to System assembly 2012-02-10 14:56:23 +00:00
Atsushi Eno a0a00924d2 Marked a couple of tests as NotDotNet as they blocked nunit completion on .NET. 2011-04-06 16:53:02 +09:00
Paolo Molaro b795fe8f87 Implemented fast version of ThreadLocal<T>.
This patchset implements a fast version of ThreadLocal<T> by reusing the code from
the implementation of the ThreadStatic attribute. The tls slots are cleaned up
on Dispose (or Finalize) instead of during appdomain shutdown.
Since C# doesn't allow us to define an icall that returns a T& or a T* type, a JIT
hack is used: every load field address instruction for the tlsdata field in
ThreadLocal<T> is intercepted and trasformed into a tls access by using the tls_offset
field from the same ThreadLocal<T> instance. So, while the C# code looks like
it accesses and changes an instance field, under the hood it will access the tls
storage.
The end result is that this is 5-6 times faster than the previous code, 10-15%
faster than using Thread.GetData () (when used with references).
This implementation also fixes a number of issues with disposing and with
per-thread initializers throwing an exception.
2011-03-01 16:43:48 +01:00
Jérémie Laval 8f1768e2de Update ThreadLocal to use default(T) for initialization with parameterless ctor following comment on https://connect.microsoft.com/VisualStudio/feedback/details/630350/threadlocal-documentation-and-actual-behavior-mismatch 2011-01-04 11:14:25 +00:00
Jérémie Laval c76a103c34 Rename ThreadLocal unit tests to reflect API name change (was ThreadLazy). 2010-08-04 19:27:10 +02:00