[Lldb-commits] [PATCH] Implements a HostThread class.
jingham at apple.com
jingham at apple.com
Thu Aug 28 16:40:35 PDT 2014
Maybe I need to wait till I see you use this, but I'm kind of surprised that the HostThread implementation has no base HostThread class here. There is generic code in lldb that will need or want to use HostThreads. For instance we have to create threads in lldb (e.g. Process has to create the thread that manages the internal state machine, and ProcessGDBRemote the reading thread) and we like to name the threads we create so that debugging lldb and reading Crash logs is easier, etc.
As you have it written, how do I know which HostThread methods it is safe to call in generic code? And how do we make sure we have a common interface to these methods across all implementations. Am I just supposed to read all the HostThreadXXX.h and use only the intersection of their public methods. That seems awkward.
I expected to have a HostThread.h that declared as virtual methods all the thread operations you must provide to be a host onto which lldb can be ported, and the interface you must provide. Maybe we could make a distinction between necessary (like Create) and useful (like Name) where the former has to work for lldb to function, and the latter can be no-op's. Then the HostThreadXXX classes would derive from this, and add whatever native methods they offered, but those methods could only be called from HostXXX code. If you started needing to call HostThreadXXX methods in generic code, then you were doing something wrong.
> On Aug 28, 2014, at 2:51 PM, Zachary Turner <zturner at google.com> wrote:
> Hi majnemer, rnk, emaste, tfiala,
> This class implements a host thread for the different platforms. As with HostProcess, no code has been updated to use HostThread yet, as this will clutter up the code review unnecessarily. However, the methods of HostThread generally map to methods of Host, so the conversion should be mostly mechanical. Because the actual conversion of client code has not been updated to use HostThread yet, it means the code in HostThread is largely duplicated. This duplication will be removed after the transition takes place.
> I'm not super good at Linux, MacOSX, or FreeBSD, so I've included various people as reviewers in hopes of catching anything I may have implemented incorrectly. But don't feel obligated to review everything.
> I've compiled and tested these changes on Mac, Linux, and Windows. (note, however, since nobody has been updated to use HostThread yet, there's little to actually test).
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
More information about the lldb-commits