[Lldb-commits] [PATCH] D129012: [lldb] [test] Improve stability of llgs vCont-threads tests

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 6 06:38:58 PDT 2022


labath accepted this revision.
labath added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lldb/test/API/tools/lldb-server/vCont-threads/main.cpp:32
+                  get_thread_id());
+    write(STDOUT_FILENO, buf, strlen(buf));
+
----------------
mgorny wrote:
> 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.
We have tests like that, but I think they're all related to the situations where we want to ensure some things happen as concurrently as possible. This is not one of those cases, and I don't see any problem with using mutexes here (and it definitely won't be the first such test).


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

https://reviews.llvm.org/D129012



More information about the lldb-commits mailing list