Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 7 of 7 for Lockable (0.22 sec)

  1. 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)
  2. 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)
  3. platforms/core-execution/persistent-cache/src/test/groovy/org/gradle/cache/internal/AbstractFileLockManagerTest.groovy

        List<Closeable> openedLocks = []
    
        def setup() {
            testFile = tmpDir.createFile("state.bin")
            testFileLock = tmpDir.file(testFile.name + ".lock")
            testDir = tmpDir.createDir("lockable-dir")
            testDirLock = tmpDir.file("${testDir.name}/${testDir.name}.lock")
    
            metaDataProvider.processIdentifier >> '123'
            metaDataProvider.processDisplayName >> 'process'
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Tue Apr 16 15:49:51 UTC 2024
    - 13.6K bytes
    - Viewed (0)
  4. 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)
  5. 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)
  6. staging/src/k8s.io/apiserver/pkg/endpoints/installer.go

    				if len(jsonName) == 0 {
    					continue
    				}
    				if excludedNameSet.Has(jsonName) {
    					continue
    				}
    				var desc string
    				if docable, ok := obj.(documentable); ok {
    					desc = docable.SwaggerDoc()[jsonName]
    				}
    				route.Param(ws.QueryParameter(jsonName, desc).DataType(typeToJSON(sf.Type.String())))
    			}
    		}
    	}
    	return nil
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Mar 01 18:15:22 UTC 2024
    - 51.5K bytes
    - Viewed (0)
  7. pkg/kubelet/nodestatus/setters_test.go

    					"Diff: %s", cmp.Diff(testCase.expectedAnnotations, existingNode.Annotations))
    			}
    		})
    	}
    }
    
    // We can't test failure or autodetection cases here because the relevant code isn't mockable
    func TestNodeAddress_NoCloudProvider(t *testing.T) {
    	cases := []struct {
    		name              string
    		nodeIPs           []net.IP
    		expectedAddresses []v1.NodeAddress
    		shouldError       bool
    	}{
    		{
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Apr 25 21:47:24 UTC 2024
    - 76.1K bytes
    - Viewed (0)
Back to top