未验证 提交 42f56e28 编写于 作者: A Andrei Matei 提交者: GitHub

proc: add minor comments (#2228)

This patch adds some comments around RequestManualStop().
上级 c94db60d
...@@ -98,6 +98,7 @@ type ThreadInfo interface { ...@@ -98,6 +98,7 @@ type ThreadInfo interface {
// ProcessManipulation is an interface for changing the execution state of a process. // ProcessManipulation is an interface for changing the execution state of a process.
type ProcessManipulation interface { type ProcessManipulation interface {
// RequestManualStop attempts to stop all the process' threads.
RequestManualStop() error RequestManualStop() error
// CheckAndClearManualStopRequest returns true the first time it's called // CheckAndClearManualStopRequest returns true the first time it's called
// after a call to RequestManualStop. // after a call to RequestManualStop.
......
...@@ -27,11 +27,14 @@ type nativeProcess struct { ...@@ -27,11 +27,14 @@ type nativeProcess struct {
os *osProcessDetails os *osProcessDetails
firstStart bool firstStart bool
stopMu sync.Mutex
resumeChan chan<- struct{} resumeChan chan<- struct{}
ptraceChan chan func() ptraceChan chan func()
ptraceDoneChan chan interface{} ptraceDoneChan chan interface{}
childProcess bool // this process was launched, not attached to childProcess bool // this process was launched, not attached to
stopMu sync.Mutex // protects manualStopRequested
// manualStopRequested is set if all the threads in the process were
// signalled to stop as a result of a Halt API call. Used to disambiguate
// why a thread is found to have stopped.
manualStopRequested bool manualStopRequested bool
// Controlling terminal file descriptor for // Controlling terminal file descriptor for
...@@ -176,7 +179,7 @@ func (dbp *nativeProcess) Breakpoints() *proc.BreakpointMap { ...@@ -176,7 +179,7 @@ func (dbp *nativeProcess) Breakpoints() *proc.BreakpointMap {
return &dbp.breakpoints return &dbp.breakpoints
} }
// RequestManualStop sets the `halt` flag and // RequestManualStop sets the `manualStopRequested` flag and
// sends SIGSTOP to all threads. // sends SIGSTOP to all threads.
func (dbp *nativeProcess) RequestManualStop() error { func (dbp *nativeProcess) RequestManualStop() error {
if dbp.exited { if dbp.exited {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册