Skip to content

Commit

Permalink
doc: clarify safety of multiple and concurent os.(*File).Close() calls
Browse files Browse the repository at this point in the history
Fixes #32427

Change-Id: I4b863bd3836067dcc2eb3a9c3a7169656763d003
Reviewed-on: https://go-review.googlesource.com/c/go/+/180438
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
  • Loading branch information
msoedov authored and robpike committed Jun 5, 2019
1 parent 49200e3 commit fc70527
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/os/file_plan9.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ func openFileNolog(name string, flag int, perm FileMode) (*File, error) {
// Close closes the File, rendering it unusable for I/O.
// On files that support SetDeadline, any pending I/O operations will
// be canceled and return immediately with an error.
// Close will return an error if it has already been called.
func (f *File) Close() error {
if err := f.checkValid("close"); err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions src/os/file_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ func openFileNolog(name string, flag int, perm FileMode) (*File, error) {
// Close closes the File, rendering it unusable for I/O.
// On files that support SetDeadline, any pending I/O operations will
// be canceled and return immediately with an error.
// Close will return an error if it has already been called.
func (f *File) Close() error {
if f == nil {
return ErrInvalid
Expand Down
1 change: 1 addition & 0 deletions src/os/file_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ func openFileNolog(name string, flag int, perm FileMode) (*File, error) {
// Close closes the File, rendering it unusable for I/O.
// On files that support SetDeadline, any pending I/O operations will
// be canceled and return immediately with an error.
// Close will return an error if it has already been called.
func (file *File) Close() error {
if file == nil {
return ErrInvalid
Expand Down

0 comments on commit fc70527

Please sign in to comment.