Skip to content

Commit 3a7851c

Browse files
prattmicgvisor-bot
authored andcommitted
Adjust WaitReasonSemacquire for go1.25
https://go.dev/cl/670497 adds a new waitReason, which changes the value of waitReasonSemacquire. PiperOrigin-RevId: 762083655
1 parent 14ece0d commit 3a7851c

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

pkg/sync/BUILD

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ go_library(
2626
"race_unsafe.go",
2727
"runtime.go",
2828
"runtime_amd64.go",
29-
"runtime_constants.go",
29+
"runtime_constants_go125.go",
30+
"runtime_constants_not_go125.go",
3031
"runtime_exectracer2.go",
3132
"runtime_go121_unsafe.go",
3233
"runtime_go124_unsafe.go",

pkg/sync/runtime_constants_go125.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2023 The gVisor Authors.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// https://go.dev/cl/670497 (1.25) adds a new wait reason, adjusting the value of waitReasonSemacquire.
16+
//go:build go1.25
17+
18+
package sync
19+
20+
// Values for the reason argument to gopark, from Go's src/runtime/runtime2.go.
21+
const (
22+
WaitReasonSelect uint8 = 9 // +checkconst runtime waitReasonSelect
23+
WaitReasonChanReceive uint8 = 14 // +checkconst runtime waitReasonChanReceive
24+
WaitReasonSemacquire uint8 = 19 // +checkconst runtime waitReasonSemacquire
25+
)

pkg/sync/runtime_constants.go renamed to pkg/sync/runtime_constants_not_go125.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
// https://go.dev/cl/670497 (1.25) adds a new wait reason, adjusting the value of waitReasonSemacquire.
16+
//go:build !go1.25
17+
1518
package sync
1619

1720
// Values for the reason argument to gopark, from Go's src/runtime/runtime2.go.

0 commit comments

Comments
 (0)