[Lldb-commits] [PATCH] D139484: [lldb/test] Fix data racing issue in TestStackCoreScriptedProcess
Med Ismail Bennani via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Dec 6 16:08:27 PST 2022
mib created this revision.
mib added reviewers: JDevlieghere, bulbazord.
mib added a project: LLDB.
Herald added a project: All.
mib requested review of this revision.
Herald added a subscriber: lldb-commits.
This patch should fix an undeterministic error in TestStackCoreScriptedProcess.
In order to test both the multithreading capability and shared library
loading in Scripted Processes, the test would create multiple threads
that would take the same variable as a reference.
The first thread would alter the value and the second thread would
monitor the value until it gets altered. This assumed a certain ordering
regarding the `std::thread` spawning, however the ordering was not
always guaranteed at runtime.
To fix that, the test now makes use of a `std::condition_variable`
shared between the each thread. On the former, it will notify the other
thread when the variable gets initialized or updated and on the latter,
it will wait until the variable it receives a new notification.
This should fix the data racing issue while preserving the testing
coverage.
rdar://98678134
Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D139484
Files:
lldb/test/API/functionalities/scripted_process/Makefile
lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py
lldb/test/API/functionalities/scripted_process/baz.c
lldb/test/API/functionalities/scripted_process/baz.cpp
lldb/test/API/functionalities/scripted_process/baz.h
lldb/test/API/functionalities/scripted_process/main.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139484.480672.patch
Type: text/x-patch
Size: 4577 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221207/c77d193c/attachment-0001.bin>
More information about the lldb-commits
mailing list