================
@@ -110,6 +117,7 @@ class PipeEvent : public MainLoopWindows::IOEvent {
         continue;
       }
 
+      ResetEvent(m_ready);
       SetEvent(m_event);
----------------
labath wrote:

I think there's still a race here where if `WillPoll` runs between these two 
calls, it will observe both of them as unset, and trigger another iteration of 
the loop, even though we haven't consumed the previous event.  That next 
iteration could race with the consumption of that event.

I *think* that reversing the order is enough to avoid this.

```suggestion
      // Notify that data is available on the pipe. It's important to set this 
before clearing m_ready to avoid a race with WillPoll.
      SetEvent(m_event);
      // Stop polling until we're told to resume.
      ResetEvent(m_ready);
```

https://github.com/llvm/llvm-project/pull/147438
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to