Source file src/internal/poll/file_plan9.go

     1  // Copyright 2022 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package poll
     6  
     7  // Expose fdMutex for use by the os package on Plan 9.
     8  // On Plan 9 we don't want to use async I/O for file operations,
     9  // but we still want the locking semantics that fdMutex provides.
    10  
    11  // FDMutex is an exported fdMutex, only for Plan 9.
    12  type FDMutex struct {
    13  	fdmu fdMutex
    14  }
    15  
    16  func (fdmu *FDMutex) Incref() bool {
    17  	return fdmu.fdmu.incref()
    18  }
    19  
    20  func (fdmu *FDMutex) Decref() bool {
    21  	return fdmu.fdmu.decref()
    22  }
    23  
    24  func (fdmu *FDMutex) IncrefAndClose() bool {
    25  	return fdmu.fdmu.increfAndClose()
    26  }
    27  
    28  func (fdmu *FDMutex) ReadLock() bool {
    29  	return fdmu.fdmu.rwlock(true)
    30  }
    31  
    32  func (fdmu *FDMutex) ReadUnlock() bool {
    33  	return fdmu.fdmu.rwunlock(true)
    34  }
    35  
    36  func (fdmu *FDMutex) WriteLock() bool {
    37  	return fdmu.fdmu.rwlock(false)
    38  }
    39  
    40  func (fdmu *FDMutex) WriteUnlock() bool {
    41  	return fdmu.fdmu.rwunlock(false)
    42  }
    43  

View as plain text