OLD | NEW |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // +build darwin freebsd linux netbsd openbsd | 5 // +build darwin freebsd linux netbsd openbsd |
6 | 6 |
7 package syscall | 7 package syscall |
8 | 8 |
9 import ( | 9 import ( |
10 "runtime" | 10 "runtime" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 return | 136 return |
137 } | 137 } |
138 | 138 |
139 func Write(fd int, p []byte) (n int, err error) { | 139 func Write(fd int, p []byte) (n int, err error) { |
140 if raceenabled { | 140 if raceenabled { |
141 raceReleaseMerge(unsafe.Pointer(&ioSync)) | 141 raceReleaseMerge(unsafe.Pointer(&ioSync)) |
142 } | 142 } |
143 return write(fd, p) | 143 return write(fd, p) |
144 } | 144 } |
145 | 145 |
| 146 // WriteNB does a write system call to a descriptor that has been set to |
| 147 // non-blocking mode. Do not call this with a descriptor in blocking mode.· |
| 148 // Blocking mode is the default for all descriptors other than sockets· |
| 149 // opened by the net package. |
| 150 func WriteNB(fd int, p []byte) (n int, err error) { |
| 151 if raceenabled { |
| 152 raceReleaseMerge(unsafe.Pointer(&ioSync)) |
| 153 } |
| 154 return writeNB(fd, p) |
| 155 } |
| 156 |
146 var ioSync int64 | 157 var ioSync int64 |
OLD | NEW |