Skip to content

Commit d429e3e

Browse files
committed
runtime: handle windows callback on non-go thread
- additional comments as per reviewer
1 parent 51f9bd2 commit d429e3e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/runtime/proc.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,7 @@ func mstart1() {
12941294
func mstartm0() {
12951295
// Create an extra M for callbacks on threads not created by Go.
12961296
// An extra M is also needed on Windows for callbacks created by
1297-
// syscall.NewCallback.
1297+
// syscall.NewCallback. See issue #6751 for details.
12981298
if (iscgo || GOOS == "windows") && !cgoHasExtraM {
12991299
cgoHasExtraM = true
13001300
newextram()
@@ -1623,7 +1623,8 @@ func needm(x byte) {
16231623
if (iscgo || GOOS == "windows") && !cgoHasExtraM {
16241624
// Can happen if C/C++ code calls Go from a global ctor.
16251625
// Can also happen on Windows if a global ctor uses a
1626-
// callback created using syscall.NewCallback.
1626+
// callback created by syscall.NewCallback. See issue #6751
1627+
// for details.
16271628
//
16281629
// Can not throw, because scheduler is not initialized yet.
16291630
write(2, unsafe.Pointer(&earlycgocallback[0]), int32(len(earlycgocallback)))
@@ -4222,7 +4223,8 @@ func checkdead() {
42224223

42234224
// If we are not running under cgo, but we have an extra M then account
42244225
// for it. (It is possible to have an extra M on Windows without cgo to
4225-
// accommodate callbacks created by syscall.NewCallback.)
4226+
// accommodate callbacks created by syscall.NewCallback. See issue #6751
4227+
// for details.)
42264228
var run0 int32
42274229
if !iscgo && cgoHasExtraM {
42284230
run0 = 1

0 commit comments

Comments
 (0)