Skip to content

Commit

Permalink
proc/native: partial support for Windows async preempt mechanism
Browse files Browse the repository at this point in the history
See golang/go#36494 for a description of why
full support for 1.14 under windows is problematic.
  • Loading branch information
aarzilli committed Jan 10, 2020
1 parent 859c7e4 commit 3a700e7
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions pkg/proc/native/threads_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,17 @@ func (t *Thread) singleStep() error {
return err
}

_, err = _ResumeThread(t.os.hThread)
if err != nil {
return err
suspendcnt := 0

for {
n, err := _ResumeThread(t.os.hThread)
if err != nil {
return err
}
suspendcnt++
if n == 1 {
break
}
}

for {
Expand All @@ -63,9 +71,11 @@ func (t *Thread) singleStep() error {
})
}

_, err = _SuspendThread(t.os.hThread)
if err != nil {
return err
for i := 0; i < suspendcnt; i++ {
_, err = _SuspendThread(t.os.hThread)
if err != nil {
return err
}
}

t.dbp.execPtraceFunc(func() {
Expand Down

0 comments on commit 3a700e7

Please sign in to comment.