예제 #1
0
 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);
 }
예제 #2
0
 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
     );
예제 #3
0
        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();
        }
예제 #4
0
        private void ReadResult(uint nodeCount, WaitChanNodeInfo.Native *nodeArray)
        {
            var result = new List <WaitChanNodeInfo>();

            completionSource.SetResult(result);
        }
예제 #5
0
        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);
        }