From: Alex Myasoedov Date: Tue, 4 Jun 2019 18:07:57 +0000 (+0200) Subject: doc: clarify safety of multiple and concurent os.(*File).Close() calls X-Git-Tag: go1.13beta1~140 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=fc705275c34233ffc1cb34be965f289589de9ba6;p=gostls13.git doc: clarify safety of multiple and concurent os.(*File).Close() calls Fixes #32427 Change-Id: I4b863bd3836067dcc2eb3a9c3a7169656763d003 Reviewed-on: https://go-review.googlesource.com/c/go/+/180438 Reviewed-by: Ian Lance Taylor Reviewed-by: Rob Pike --- diff --git a/src/os/file_plan9.go b/src/os/file_plan9.go index 14091873cf..e0a3826a34 100644 --- a/src/os/file_plan9.go +++ b/src/os/file_plan9.go @@ -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 diff --git a/src/os/file_unix.go b/src/os/file_unix.go index 89c05b2657..754e859645 100644 --- a/src/os/file_unix.go +++ b/src/os/file_unix.go @@ -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 diff --git a/src/os/file_windows.go b/src/os/file_windows.go index 08444d728f..1e78f4e867 100644 --- a/src/os/file_windows.go +++ b/src/os/file_windows.go @@ -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