Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for increfAndClose (0.18 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)
  6. src/internal/poll/fd_unix.go

    	return err
    }
    
    // Close closes the FD. The underlying file descriptor is closed by the
    // destroy method when there are no remaining references.
    func (fd *FD) Close() error {
    	if !fd.fdmu.increfAndClose() {
    		return errClosing(fd.isFile)
    	}
    
    	// Unblock any I/O.  Once it all unblocks and returns,
    	// so that it cannot be referring to fd.sysfd anymore,
    	// the final decref will close fd.sysfd. This should happen
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 31 04:09:44 UTC 2024
    - 17.9K bytes
    - Viewed (0)
  7. src/os/file_plan9.go

    func (f *File) Close() error {
    	if f == nil {
    		return ErrInvalid
    	}
    	return f.file.close()
    }
    
    func (file *file) close() error {
    	if !file.fdmu.IncrefAndClose() {
    		return &PathError{Op: "close", Path: file.name, Err: ErrClosed}
    	}
    
    	// At this point we should cancel any pending I/O.
    	// How do we do that on Plan 9?
    
    	err := file.decref()
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 30 15:35:30 UTC 2024
    - 16K bytes
    - Viewed (0)
  8. src/internal/poll/fd_windows.go

    	return err
    }
    
    // Close closes the FD. The underlying file descriptor is closed by
    // the destroy method when there are no remaining references.
    func (fd *FD) Close() error {
    	if !fd.fdmu.increfAndClose() {
    		return errClosing(fd.isFile)
    	}
    	if fd.kind == kindPipe {
    		syscall.CancelIoEx(fd.Sysfd, nil)
    	}
    	// unblock pending reader and writer
    	fd.pd.evict()
    	err := fd.decref()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jan 31 16:50:42 UTC 2024
    - 34.1K bytes
    - Viewed (0)
Back to top