]> Cypherpunks repositories - gostls13.git/commitdiff
doc: clarify safety of multiple and concurent os.(*File).Close() calls
authorAlex Myasoedov <msoedov@gmail.com>
Tue, 4 Jun 2019 18:07:57 +0000 (20:07 +0200)
committerRob Pike <r@golang.org>
Wed, 5 Jun 2019 21:21:59 +0000 (21:21 +0000)
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>
src/os/file_plan9.go
src/os/file_unix.go
src/os/file_windows.go

index 14091873cf96c8faf80c617a0b9b8c1679634b94..e0a3826a34cb7b4f4a330b3a0f1230e250c7d1a4 100644 (file)
@@ -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
index 89c05b26572afd9d75d51e1591042aa45ad40416..754e859645388ad401b2ec8695ef30a01ca4bfc6 100644 (file)
@@ -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
index 08444d728f6740f689d1013f9aee64137c5b3eae..1e78f4e8670012e6dff3c42b5f2025a9b770b21d 100644 (file)
@@ -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