This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Synchronize the output through the IOHandler
ClosedPublic

Authored by JDevlieghere on Mar 12 2022, 5:27 PM.

Details

Reviewers
labath
Summary

Alternative to D121500 that does the locking at the IOHandler level.

Diff Detail

Event Timeline

JDevlieghere created this revision.Mar 12 2022, 5:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 12 2022, 5:27 PM

That is roughly what I had in mind, *but* if you look inside Editline class, you'll see that it already declares a std::mutex m_output_mutex variable. It was introduced for the same reason as this mutex here, although it only controls stdout access during command line editing (and not when the command output is printed).

Ideally we wouldn't have two mutexes controlling stdout access. I think it should be possible to delete the mutex in the Editline class, and replace it with (a reference to?) the mutex you define here, but I haven't tried proving to myself that this will work.

Use the IOHandler's mutex in editline

Update unit test

labath accepted this revision.Mar 15 2022, 2:29 AM
labath added inline comments.
lldb/include/lldb/Interpreter/CommandInterpreter.h
659
This revision is now accepted and ready to land.Mar 15 2022, 2:29 AM