Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for increfAndClose (0.15 sec)

  1. src/internal/poll/export_test.go

    package poll
    
    var Consume = consume
    
    type XFDMutex struct {
    	fdMutex
    }
    
    func (mu *XFDMutex) Incref() bool {
    	return mu.incref()
    }
    
    func (mu *XFDMutex) IncrefAndClose() bool {
    	return mu.increfAndClose()
    }
    
    func (mu *XFDMutex) Decref() bool {
    	return mu.decref()
    }
    
    func (mu *XFDMutex) RWLock(read bool) bool {
    	return mu.rwlock(read)
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Oct 08 03:57:40 UTC 2022
    - 714 bytes
    - Viewed (0)
  2. src/internal/poll/file_plan9.go

    	fdmu fdMutex
    }
    
    func (fdmu *FDMutex) Incref() bool {
    	return fdmu.fdmu.incref()
    }
    
    func (fdmu *FDMutex) Decref() bool {
    	return fdmu.fdmu.decref()
    }
    
    func (fdmu *FDMutex) IncrefAndClose() bool {
    	return fdmu.fdmu.increfAndClose()
    }
    
    func (fdmu *FDMutex) ReadLock() bool {
    	return fdmu.fdmu.rwlock(true)
    }
    
    func (fdmu *FDMutex) ReadUnlock() bool {
    	return fdmu.fdmu.rwunlock(true)
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Oct 08 03:57:40 UTC 2022
    - 972 bytes
    - Viewed (0)
  3. src/internal/poll/fd_mutex_test.go

    		t.Fatal("broken")
    	}
    }
    
    func TestMutexClose(t *testing.T) {
    	var mu XFDMutex
    	if !mu.IncrefAndClose() {
    		t.Fatal("broken")
    	}
    
    	if mu.Incref() {
    		t.Fatal("broken")
    	}
    	if mu.RWLock(true) {
    		t.Fatal("broken")
    	}
    	if mu.RWLock(false) {
    		t.Fatal("broken")
    	}
    	if mu.IncrefAndClose() {
    		t.Fatal("broken")
    	}
    }
    
    func TestMutexCloseUnblock(t *testing.T) {
    	c := make(chan bool, 4)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Oct 08 03:57:40 UTC 2022
    - 4K bytes
    - Viewed (0)
  4. src/internal/poll/fd_mutex.go

    		if new&mutexRefMask == 0 {
    			panic(overflowMsg)
    		}
    		if atomic.CompareAndSwapUint64(&mu.state, old, new) {
    			return true
    		}
    	}
    }
    
    // increfAndClose sets the state of mu to closed.
    // It returns false if the file was already closed.
    func (mu *fdMutex) increfAndClose() bool {
    	for {
    		old := atomic.LoadUint64(&mu.state)
    		if old&mutexClosed != 0 {
    			return false
    		}
    		// Mark as closed and acquire a reference.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jun 20 16:55:30 UTC 2018
    - 6.4K bytes
    - Viewed (0)
  5. src/internal/poll/fd_plan9.go

    	if fd.Destroy != nil {
    		fd.Destroy()
    	}
    	return nil
    }
    
    // Close handles the locking for closing an FD. The real operation
    // is in the net package.
    func (fd *FD) Close() error {
    	if !fd.fdmu.increfAndClose() {
    		return errClosing(fd.isFile)
    	}
    	return nil
    }
    
    // Read implements io.Reader.
    func (fd *FD) Read(fn func([]byte) (int, error), b []byte) (int, error) {
    	if err := fd.readLock(); err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 06 14:00:54 UTC 2024
    - 5.4K bytes
    - Viewed (0)
Back to top