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 unsafe WaitChainSession() { handle = OpenThreadWaitChainSession( (uint)WCT_SESSION_OPEN_FLAGS.WCT_ASYNC_OPEN_FLAG, AsyncOperation.asyncCallback ); if (handle.IsInvalid) { throw new Win32Exception(); } }
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); }