CallContext thread safe

T

Tommaso Caldarola

If I call System.Runtime.Remoting.CallContext.SetData() and then I call
System.Runtime.Remoting.CallContext.GetData() from a different thread I get
null, if the thread indeed is the same I get right data.

How to do CallContext.GetData() thread safe?




Inviato da X-Privat.Org - Registrazione gratuita http://www.x-privat.org/join.php
 
N

Nicholas Paldino [.NET/C# MVP]

Tommaso,

The call is thread safe. However, the CallContext in a separate thread
is different than in the thread where you set the data. When you call
SetData, it is like thread local storage, it is only local to that thread of
execution.

You need to store the data some other way.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top