-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
go.mod: gvisor.dev/gvisor v0.0.0-20221216231429-a78e892a26d2
Signed-off-by: Akihiro Suda <[email protected]>
- Loading branch information
1 parent
7f0e6e6
commit d098437
Showing
132 changed files
with
5,289 additions
and
1,810 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Copyright 2022 The gVisor Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package atomicbitops | ||
|
||
import "sync/atomic" | ||
|
||
// Bool is an atomic Boolean. | ||
// | ||
// It is implemented by a Uint32, with value 0 indicating false, and 1 | ||
// indicating true. | ||
// | ||
// +stateify savable | ||
type Bool struct { | ||
Uint32 | ||
} | ||
|
||
// FromBool returns an Bool initialized to value val. | ||
// | ||
//go:nosplit | ||
func FromBool(val bool) Bool { | ||
var u uint32 | ||
if val { | ||
u = 1 | ||
} | ||
return Bool{ | ||
Uint32{ | ||
value: u, | ||
}, | ||
} | ||
} | ||
|
||
// Load is analogous to atomic.LoadBool, if such a thing existed. | ||
// | ||
//go:nosplit | ||
func (b *Bool) Load() bool { | ||
return atomic.LoadUint32(&b.value) == 1 | ||
} | ||
|
||
// Store is analogous to atomic.StoreBool, if such a thing existed. | ||
// | ||
//go:nosplit | ||
func (b *Bool) Store(val bool) { | ||
var u uint32 | ||
if val { | ||
u = 1 | ||
} | ||
atomic.StoreUint32(&b.value, u) | ||
} | ||
|
||
// Swap is analogous to atomic.SwapBool, if such a thing existed. | ||
// | ||
//go:nosplit | ||
func (b *Bool) Swap(val bool) bool { | ||
var u uint32 | ||
if val { | ||
u = 1 | ||
} | ||
return atomic.SwapUint32(&b.value, u) == 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.