Skip to content

Commit 1f76445

Browse files
committed
fix scheduler issue on uncaught exceptions (fixes gopherjs#225)
1 parent 6126880 commit 1f76445

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

compiler/prelude/goroutines.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,14 @@ var $schedule = function(goroutine, direct) {
167167
if (!$schedulerLoopActive) {
168168
$schedulerLoopActive = true;
169169
setTimeout(function() {
170-
while (true) {
171-
var r = $scheduled.shift();
172-
if (r === undefined) {
173-
$schedulerLoopActive = false;
174-
break;
170+
try {
171+
var r;
172+
while ((r = $scheduled.shift()) !== undefined) {
173+
r();
175174
}
176-
r();
177-
};
175+
} finally {
176+
$schedulerLoopActive = false;
177+
}
178178
}, 0);
179179
}
180180
};

0 commit comments

Comments
 (0)