mscorlib(4.0.0.0) API with additions
ADAsyncWorkItem.cs
2 using System.Security;
3 using System.Threading;
4 
6 {
7  internal class ADAsyncWorkItem
8  {
9  private IMessageSink _replySink;
10 
11  private IMessageSink _nextSink;
12 
13  [SecurityCritical]
14  private LogicalCallContext _callCtx;
15 
16  private IMessage _reqMsg;
17 
18  [SecurityCritical]
19  internal ADAsyncWorkItem(IMessage reqMsg, IMessageSink nextSink, IMessageSink replySink)
20  {
21  _reqMsg = reqMsg;
22  _nextSink = nextSink;
23  _replySink = replySink;
24  _callCtx = Thread.CurrentThread.GetMutableExecutionContext().LogicalCallContext;
25  }
26 
27  [SecurityCritical]
28  internal virtual void FinishAsyncWork(object stateIgnored)
29  {
30  LogicalCallContext logicalCallContext = CallContext.SetLogicalCallContext(_callCtx);
31  IMessage msg = _nextSink.SyncProcessMessage(_reqMsg);
32  if (_replySink != null)
33  {
34  _replySink.SyncProcessMessage(msg);
35  }
36  CallContext.SetLogicalCallContext(logicalCallContext);
37  }
38  }
39 }
static Thread CurrentThread
Gets the currently running thread.
Definition: Thread.cs:134
IMessage SyncProcessMessage(IMessage msg)
Synchronously processes the given message.
Definition: __Canon.cs:3
Provides a set of properties that are carried with the execution code path. This class cannot be inhe...
Definition: CallContext.cs:12
Provides a set of properties that are carried with the execution code path during remote method calls...
Contains communication data sent between cooperating message sinks.
Definition: IMessage.cs:9
Defines the interface for a message sink.
Definition: IMessageSink.cs:8
Creates and controls a thread, sets its priority, and gets its status.
Definition: Thread.cs:18