[Mono-devel-list] [PATCH] Stack propagation for Thread, Delegates and ThreadPool

Sebastien Pouliot sebastien at ximian.com
Fri May 13 10:33:50 EDT 2005


Hello,

This patch adds support for stack|context propagation between threads in
the following cases:

        * Thread.Start;
        * delegates (BeginInvoke|EndInvoke);
        * ThreadPool.[Unsafe]QueueUserWorkItem;
        
Several tests are available under
/mono/mono/tests/cas/threads/


Note that the propagation stuff is much updated in CLR|FX 2.0, i.e. it
doesn't _only_ apply to security anymore. This is why the runtime patch
looks for either (a) the security manager being active or (b) a corlib
version > 2.x to enable the capture of the execution context of the
thread (but in the later case the CAS security stack propagation is
still only done if the security manager is active).

The ThreadPool.UnsafeQueueUserWorkItem is "unsafe" in two ways ;-) First
it unsafe framework-wise because (a) it doesn't propagate the stack (so
it has some security prerequisites) and (b) the current implementation
doesn't make it 100% sure that the stack won't be propagated (if the
other rules applies). We're missing a "safe" way to tell the runtime if
we want a safe or unsafe invocation.


Comments welcome!


P.S. A previous patch was sent to mono-winforms-list, earlier this week,
for dealing with Control.BeginInvoke. The (updated) code is already in
SVN.
http://lists.ximian.com/archives/public/mono-winforms-list/2005-May/001635.html
-- 
Sebastien Pouliot  <sebastien at ximian.com>
blog: http://pages.infinit.net/ctech/poupou.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mono.20050513.diff
Type: text/x-patch
Size: 6659 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050513/549feee6/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: corlib.20050513.diff
Type: text/x-patch
Size: 3929 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050513/549feee6/attachment-0001.bin 


More information about the Mono-devel-list mailing list