public void NT_CancelPollEntryListener(NtEntryListenerPoller poller) { Native_NT_CancelPollEntryListener(poller); }
private CancellationTokenSource CreateEntryListenerThread() { m_entryListenerPoller = NtCore.CreateEntryListenerPoller(Handle); CancellationTokenSource source = new CancellationTokenSource(); var ret = new Thread(() => { bool wasInterrupted = false; var token = source.Token; token.Register(() => { NtCore.CancelPollEntryListener(m_entryListenerPoller); }); while (!token.IsCancellationRequested) { var events = NtCore.PollEntryListener(m_entryListenerPoller); if (token.IsCancellationRequested) { NtCore.DisposeEntryListenerSpan(events); break; } if (events.Length == 0) { NtCore.DisposeEntryListenerSpan(events); lock (m_entryListenerWaitQueueLock) { if (m_entryListenerWaitQueue) { m_entryListenerWaitQueue = false; Monitor.PulseAll(m_entryListenerWaitQueueLock); continue; } } wasInterrupted = true; break; } for (int i = 0; i < events.Length; i++) { EntryNotificationDelegate?listener; lock (m_entryListenerLock) { m_entryListeners.TryGetValue(events.Pointer[i].listener, out listener); } if (listener != null) { listener(new RefEntryNotification(this, events.Pointer[i])); if (token.IsCancellationRequested) { break; } } } NtCore.DisposeEntryListenerSpan(events); } lock (m_entryListenerWaitQueueLock) { if (!wasInterrupted) { NtCore.DestroyEntryListenerPoller(m_entryListenerPoller); } m_entryListenerPoller = new NtEntryListenerPoller(); } }) { Name = "NTEntryListener", IsBackground = true }; ret.Start(); m_entryListenerThread = ret; return(source); }
public NtEntryNotification *NT_PollEntryListenerTimeout(NtEntryListenerPoller poller, UIntPtr *len, double timeout, NtBool *timed_out) { return(Native_NT_PollEntryListenerTimeout(poller, len, timeout, timed_out)); }
private static extern void Native_NT_CancelPollEntryListener(NtEntryListenerPoller poller);
public NtEntryNotification *NT_PollEntryListener(NtEntryListenerPoller poller, UIntPtr *len) { return(Native_NT_PollEntryListener(poller, len)); }
private static extern NtEntryNotification *Native_NT_PollEntryListenerTimeout(NtEntryListenerPoller poller, UIntPtr *len, double timeout, NtBool *timed_out);
public NtEntryListener NT_AddPolledEntryListenerSingle(NtEntryListenerPoller poller, NtEntry entry, uint flags) { return(Native_NT_AddPolledEntryListenerSingle(poller, entry, flags)); }
private static extern NtEntryNotification *Native_NT_PollEntryListener(NtEntryListenerPoller poller, UIntPtr *len);
private static extern NtEntryListener Native_NT_AddPolledEntryListenerSingle(NtEntryListenerPoller poller, NtEntry entry, uint flags);
public NtEntryListener NT_AddPolledEntryListener(NtEntryListenerPoller poller, byte *prefix, UIntPtr prefix_len, uint flags) { return(Native_NT_AddPolledEntryListener(poller, prefix, prefix_len, flags)); }
private static extern NtEntryListener Native_NT_AddPolledEntryListener(NtEntryListenerPoller poller, byte *prefix, UIntPtr prefix_len, uint flags);
public void NT_DestroyEntryListenerPoller(NtEntryListenerPoller poller) { Native_NT_DestroyEntryListenerPoller(poller); }
private static extern void Native_NT_DestroyEntryListenerPoller(NtEntryListenerPoller poller);