Skip to content

Commit

Permalink
Added comment to Flush() for godoc
Browse files Browse the repository at this point in the history
  • Loading branch information
madhurjain committed Mar 14, 2015
1 parent d30c3c8 commit f143639
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions serial_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ func (p *Port) Write(b []byte) (n int, err error) {
return p.f.Write(b)
}

// Discards data written to the port but not transmitted,
// or data received but not read
func (p *Port) Flush() error {
const TCFLSH = 0x540B
_, _, err := syscall.Syscall(
Expand Down
2 changes: 2 additions & 0 deletions serial_posix.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ func (p *Port) Write(b []byte) (n int, err error) {
return p.f.Write(b)
}

// Discards data written to the port but not transmitted,
// or data received but not read
func (p *Port) Flush() error {
_, err := C.tcflush(C.int(p.f.Fd()), C.TCIOFLUSH)
return err
Expand Down
2 changes: 2 additions & 0 deletions serial_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ func (p *Port) Read(buf []byte) (int, error) {
return getOverlappedResult(p.fd, p.ro)
}

// Discards data written to the port but not transmitted,
// or data received but not read
func (p *Port) Flush() error {
return purgeComm(p.fd)
}
Expand Down

0 comments on commit f143639

Please sign in to comment.