mgorny marked an inline comment as done.
mgorny added a comment.

In D129012#3631985 <https://reviews.llvm.org/D129012#3631985>, @labath wrote:

> I can also imagine a setup where most of the verification happens inside the 
> inferior. Like, each time a thread gets to run it increments a variable 
> specific to that thread. Once that number crosses some threshold, it check 
> the variables of the other threads, and verifies that one of them has the 
> number zero, and the number of the other thread is reasonably high (> 10% of 
> the threshold or something).

I suppose this would be possible but tbh I think it'd be more complex than the 
current solution.



================
Comment at: lldb/test/API/tools/lldb-server/vCont-threads/main.cpp:32
+                  get_thread_id());
+    write(STDOUT_FILENO, buf, strlen(buf));
+
----------------
labath wrote:
> I am not sure if `write` is an (atomic) system call on windows. Maybe just 
> put a mutex around the printf call? In this setup, I think it would be 
> sufficient to write this once, and then spend the rest of the time making 
> sure the other suspended thread gets a chance to run (if it is not suspended 
> for whatever reason).
For some reason, I've assumed we're avoiding mutexes. However, this certainly 
makes sense, as well as removing duplicate writes. I've also noticed we had a 
race condition between starting prints and SIGSTOP, so I've fixed that too. Now 
the main thread is always resumed.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129012/new/

https://reviews.llvm.org/D129012

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to