Skip to content

Commit 6448c7b

Browse files
committed
Adjust WaitReasonSemacquire et al. for go1.26
https://go.dev/cl/670497 changes the order of waitReason's, which changes the value of waitReasonSemacquire. PiperOrigin-RevId: 817235794
1 parent 0799336 commit 6448c7b

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

pkg/sync/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ go_library(
2727
"runtime.go",
2828
"runtime_amd64.go",
2929
"runtime_constants_go125.go",
30+
"runtime_constants_go126.go",
3031
"runtime_constants_not_go125.go",
3132
"runtime_exectracer2.go",
3233
"runtime_go121_unsafe.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/688335 (1.26) reorders waitreason runtime constants, adjusting the values of waitReasonSemacquire et al.
16+
//go:build go1.26
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 = 18 // +checkconst runtime waitReasonSelect
23+
WaitReasonChanReceive uint8 = 19 // +checkconst runtime waitReasonChanReceive
24+
WaitReasonSemacquire uint8 = 13 // +checkconst runtime waitReasonSemacquire
25+
)

pkg/sync/runtime_constants_not_go125.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
// limitations under the License.
1414

1515
// https://go.dev/cl/670497 (1.25) adds a new wait reason, adjusting the value of waitReasonSemacquire.
16-
//go:build !go1.25
16+
// https://go.dev/cl/688335 (1.26) reorders waitreason runtime constants, adjusting the values of waitReasonSemacquire et al.
17+
//go:build !go1.25 && !go1.26
1718

1819
package sync
1920

0 commit comments

Comments
 (0)