private unsafe void asyncCallback(uint callbackStatus, ref uint nodeCount, WaitChanNodeInfo.Native *nodeInfoArray, ref bool isCycle) { if (callbackStatus != ERROR_SUCCESS) { SetException(new Win32Exception((int)callbackStatus)); return; } ReadResult(nodeCount, nodeArray); }
internal static extern unsafe bool GetThreadWaitChain( SafeWaitChainSessionHandle handle, IntPtr context, UInt32 flags, UInt32 threadId, ref UInt32 nodeCount, WaitChanNodeInfo.Native *NodeInfoArray, [MarshalAs(UnmanagedType.Bool)] out bool IsCycle );
public AsyncOperation(WaitChainSession session, GetWaitChainFlags flags, uint threadId) { this.session = session; this.threadId = threadId; this.flags = flags; completionSource = new TaskCompletionSource <List <WaitChanNodeInfo> >(); gcHandle = GCHandle.Alloc(this, GCHandleType.Normal); nodeCount = 0; nodeArray = null; IssueCall(); }
private void ReadResult(uint nodeCount, WaitChanNodeInfo.Native *nodeArray) { var result = new List <WaitChanNodeInfo>(); completionSource.SetResult(result); }
internal static unsafe void asyncCallback(SafeWaitChainSessionHandle WctHandle, IntPtr Context, uint CallbackStatus, ref uint NodeCount, WaitChanNodeInfo.Native *NodeInfoArray, ref bool IsCycle) { AsyncOperation self = (AsyncOperation)GCHandle.FromIntPtr(Context).Target; self.asyncCallback(CallbackStatus, ref NodeCount, NodeInfoArray, ref IsCycle); }