- Sort Score
- Result 10 results
- Languages All
Results 1 - 4 of 4 for Lockable (0.17 sec)
-
test/typeparam/lockable.go
package main import "sync" // A Lockable is a value that may be safely simultaneously accessed // from multiple goroutines via the Get and Set methods. type Lockable[T any] struct { x T mu sync.Mutex } // Get returns the value stored in a Lockable. func (l *Lockable[T]) get() T { l.mu.Lock() defer l.mu.Unlock() return l.x } // set sets the value in a Lockable. func (l *Lockable[T]) set(v T) {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Mar 01 19:45:34 UTC 2022 - 916 bytes - Viewed (0) -
test/typeparam/genembed2.go
"fmt" "sync" ) type MyStruct[T any] struct { val T } type Lockable[T any] struct { MyStruct[T] mu sync.Mutex } // Get returns the value stored in a Lockable. func (l *Lockable[T]) Get() T { l.mu.Lock() defer l.mu.Unlock() return l.MyStruct.val } // Set sets the value in a Lockable. func (l *Lockable[T]) Set(v T) { l.mu.Lock() defer l.mu.Unlock() l.MyStruct = MyStruct[T]{v} }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Mar 01 19:45:34 UTC 2022 - 801 bytes - Viewed (0) -
pkg/volume/util/io_util.go
See the License for the specific language governing permissions and limitations under the License. */ package util import ( "io/ioutil" "os" "path/filepath" ) // IoUtil is a mockable util for common IO operations type IoUtil interface { ReadFile(filename string) ([]byte, error) ReadDir(dirname string) ([]os.FileInfo, error) Lstat(name string) (os.FileInfo, error)
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Tue Jun 20 14:49:03 UTC 2023 - 1.4K bytes - Viewed (0) -
staging/src/k8s.io/apimachinery/pkg/watch/watch.go
return pw.result } // StopChan returns stop channel func (pw *ProxyWatcher) StopChan() <-chan struct{} { return pw.stopCh } // MockWatcher implements watch.Interface with mockable functions. type MockWatcher struct { StopFunc func() ResultChanFunc func() <-chan Event } var _ Interface = &MockWatcher{} // Stop calls StopFunc func (mw MockWatcher) Stop() {
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Wed Jun 12 20:06:22 UTC 2024 - 8.1K bytes - Viewed (1)