Some cleanup suggested when bringing up lldb-server on Windows.
Thanks to Hui Huang for the patch.
Details
Diff Detail
Event Timeline
LGTM, with some inline comments about additional c++11 goodies we can use to clean up this file further. (Also, it might be good to mention in the patch title that this is about modifying the test code, because my first though was that you are adding some locking to the actual lldb-server code.)
packages/Python/lldbsuite/test/tools/lldb-server/main.cpp | ||
---|---|---|
37–45 | Other tests already use std::this_thread::sleep_for(std::chrono::seconds(X)), so I expect you should be able to do the same here. | |
180–185 | you could just make s_thread_index an atomic<int>, and avoid the manual locking around the increment operation. | |
188–192 | use std::scoped_lock instead of manual lock/unlock calls (throughout the patch). |
packages/Python/lldbsuite/test/tools/lldb-server/main.cpp | ||
---|---|---|
188–192 | Is cxx17 now officially okay to use? |
packages/Python/lldbsuite/test/tools/lldb-server/main.cpp | ||
---|---|---|
80–84 | If the test harness was changed to link against the host support libraries and included the right header this could be factored out. |
LGTM.
The ifdefs for the getpid() code and stuff are unfortunate, but I am not sure if using llvm libraries for that is a good idea. Right now we have the ability to compile the tests for a different architecture than the one lldb is built for. If we started using non-standard facilities in the tests, this would become a lot more complicated.
packages/Python/lldbsuite/test/tools/lldb-server/main.cpp | ||
---|---|---|
188–192 | Sorry, I meant std::lock_guard here (and I see that you have used that). c++17 is not ok do be used in real code. Tests can theoretically have different (stricter, or more lax) requirements, but I don't see a reason to deviate from the official policy here. |
Other tests already use std::this_thread::sleep_for(std::chrono::seconds(X)), so I expect you should be able to do the same here.