Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 74 for locked (0.37 sec)

  1. internal/dsync/locked_rand.go

    func (r *lockedRandSource) Int63() (n int64) {
    	r.lk.Lock()
    	n = r.src.Int63()
    	r.lk.Unlock()
    	return
    }
    
    // Seed uses the provided seed value to initialize the generator to a
    // deterministic state.
    func (r *lockedRandSource) Seed(seed int64) {
    	r.lk.Lock()
    	r.src.Seed(seed)
    	r.lk.Unlock()
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Mon Oct 18 15:39:59 GMT 2021
    - 1.3K bytes
    - Viewed (0)
  2. internal/lsync/lrwmutex_test.go

    	wl := NewLRWMutex()
    	var rl sync.Locker
    	wlocked := make(chan bool, 1)
    	rlocked := make(chan bool, 1)
    	rl = wl.DRLocker()
    	n := 10
    	go func() {
    		for i := 0; i < n; i++ {
    			rl.Lock()
    			rl.Lock()
    			rlocked <- true
    			wl.Lock()
    			wlocked <- true
    		}
    	}()
    	for i := 0; i < n; i++ {
    		<-rlocked
    		rl.Unlock()
    		select {
    		case <-wlocked:
    			t.Fatal("RLocker() didn't read-lock it")
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Sun Mar 05 04:57:35 GMT 2023
    - 7.9K bytes
    - Viewed (0)
  3. internal/dsync/drwmutex.go

    			if sendRelease(ctx, ds, restClnts[lockID], owner, (*locks)[lockID], isReadLock, names...) {
    				(*locks)[lockID] = ""
    			}
    		}(lockID)
    	}
    	wg.Wait()
    
    	// Return true if releaseAll was successful, otherwise we return 'false'
    	// to indicate we haven't sufficiently unlocked lockers to avoid deadlocks.
    	//
    	// Caller may use this as an indication to call again.
    	return !checkFailedUnlocks(*locks, tolerance)
    }
    
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Thu Feb 22 06:26:06 GMT 2024
    - 19.7K bytes
    - Viewed (0)
  4. internal/lock/lock_test.go

    	}
    
    	// unlock the file
    	if err = l.Close(); err != nil {
    		t.Fatal(err)
    	}
    
    	// try lock the unlocked file
    	dupl, err := LockedOpenFile(f.Name(), os.O_WRONLY|os.O_CREATE, 0o600)
    	if err != nil {
    		t.Errorf("err = %v, want %v", err, nil)
    	}
    
    	// blocking on locked file
    	locked := make(chan struct{}, 1)
    	go func() {
    		bl, blerr := LockedOpenFile(f.Name(), os.O_WRONLY, 0o600)
    		if blerr != nil {
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Mon Sep 19 18:05:16 GMT 2022
    - 3.6K bytes
    - Viewed (0)
  5. internal/lsync/lrwmutex.go

    	const isWriteLock = false
    	return lm.lockLoop(ctx, id, source, timeout, isWriteLock)
    }
    
    func (lm *LRWMutex) lock(id, source string, isWriteLock bool) (locked bool) {
    	lm.mu.Lock()
    	defer lm.mu.Unlock()
    
    	lm.id = id
    	lm.source = source
    	if isWriteLock {
    		if lm.ref == 0 && !lm.isWriteLock {
    			lm.ref = 1
    			lm.isWriteLock = true
    			locked = true
    		}
    	} else {
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Sun Jan 02 17:15:06 GMT 2022
    - 4.8K bytes
    - Viewed (0)
  6. internal/lock/lock.go

    // Package lock - implements filesystem locking wrappers around an
    // open file descriptor.
    package lock
    
    import (
    	"errors"
    	"os"
    	"sync"
    )
    
    // ErrAlreadyLocked is returned if the underlying fd is already locked.
    var ErrAlreadyLocked = errors.New("file already locked")
    
    // RLockedFile represents a read locked file, implements a special
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Sun Jan 02 17:15:06 GMT 2022
    - 2.5K bytes
    - Viewed (0)
  7. internal/dsync/drwmutex_test.go

    	}
    	// fmt.Println("Write lock failed due to timeout")
    	return
    }
    
    func TestSimpleWriteLockAcquired(t *testing.T) {
    	locked := testSimpleWriteLock(t, 10*testDrwMutexAcquireTimeout)
    
    	expected := true
    	if locked != expected {
    		t.Errorf("TestSimpleWriteLockAcquired(): \nexpected %#v\ngot      %#v", expected, locked)
    	}
    }
    
    func TestSimpleWriteLockTimedOut(t *testing.T) {
    	locked := testSimpleWriteLock(t, testDrwMutexAcquireTimeout)
    
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Sat Dec 24 03:49:07 GMT 2022
    - 9.7K bytes
    - Viewed (0)
  8. internal/dsync/lock-args.go

    // LockArgs is minimal required values for any dsync compatible lock operation.
    type LockArgs struct {
    	// Unique ID of lock/unlock request.
    	UID string
    
    	// Resources contains single or multiple entries to be locked/unlocked.
    	Resources []string
    
    	// Source contains the line number, function and file name of the code
    	// on the client node that requested the lock.
    	Source string
    
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Thu Jan 18 04:34:26 GMT 2024
    - 1.7K bytes
    - Viewed (0)
  9. cni/pkg/nodeagent/netns_linux.go

    		}
    		defer func() {
    			err := threadNS.Set() // switch back
    			if err == nil {
    				// Unlock the current thread only when we successfully switched back
    				// to the original namespace; otherwise leave the thread locked which
    				// will force the runtime to scrap the current thread, that is maybe
    				// not as optimal but at least always safe to do.
    				runtime.UnlockOSThread()
    			}
    		}()
    
    		return toRun()
    	}
    
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Wed Jan 31 10:05:36 GMT 2024
    - 2.7K bytes
    - Viewed (0)
  10. src/cmd/cgo/internal/test/cgo_thread_lock.go

    		for {
    			select {
    			case <-stop:
    				return
    			case <-time.After(time.Millisecond * 100):
    			}
    		}
    	}()
    	defer close(stop)
    
    	for i := 0; i < 1000; i++ {
    		if !C.Ctid() {
    			t.Fatalf("cgo has not locked OS thread")
    		}
    	}
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Thu May 18 16:55:07 GMT 2023
    - 939 bytes
    - Viewed (0)
Back to top