Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Avoid thread request if continue hasnt returned #1814
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Aug 9, 2018
1 parent 11fdfbd commit 69ffb74
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Binary file modified Go-latest.vsix
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Go",
"version": "0.6.86-beta.4",
"version": "0.6.86-beta.5",
"publisher": "ms-vscode",
"description": "Rich Go language support for Visual Studio Code",
"author": {
Expand Down
14 changes: 13 additions & 1 deletion src/debugAdapter/goDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,11 @@ class GoDebugSession extends DebugSession {
}

protected threadsRequest(response: DebugProtocol.ThreadsResponse): void {
if (this.continueRequestRunning) {
// Thread request to delve is syncronous and will block if a previous async continue request didnt return
response.body = { threads: [] };
return this.sendResponse(response);
}
verbose('ThreadsRequest');
this.delve.call<DebugGoroutine[] | ListGoroutinesOut>('ListGoroutines', [], (err, out) => {
if (this.debugState.exited) {
Expand Down Expand Up @@ -953,10 +958,17 @@ class GoDebugSession extends DebugSession {
});
}
}

private continueEpoch = 0;
private continueRequestRunning = false;
protected continueRequest(response: DebugProtocol.ContinueResponse): void {
verbose('ContinueRequest');
this.continueEpoch++;
let closureEpoch = this.continueEpoch;
this.continueRequestRunning = true;
this.delve.call<DebuggerState | CommandOut>('Command', [{ name: 'continue' }], (err, out) => {
if (closureEpoch === this.continueEpoch) {
this.continueRequestRunning = false;
}
if (err) {
logError('Failed to continue - ' + err.toString());
}
Expand Down

0 comments on commit 69ffb74

Please sign in to comment.